Unable to get nativescript install


#1

I am running an ArchLinux Machine, and followed the installation instructions mentioned here (https://docs.nativescript.org/start/ns-setup-linux). I have also tested the same on a Ubuntu Docker (https://github.com/butomo1989/docker-android) . I see the same error in both the setup

Here is the error

:heavy_check_mark: Getting environment information

There seem to be issues with your configuration.
:heavy_check_mark: Getting NativeScript components versions information…
:heavy_check_mark: Component nativescript has 4.1.0 version and is up to date.
:heavy_check_mark: The Android SDK is installed.
:heavy_check_mark: Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
:heavy_multiplication_x: The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the ANDROID_HOME variable to point to the root of your Android SDK installation directory.

:heavy_multiplication_x: WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in /x.html#Requirements

:heavy_multiplication_x: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ sdkmanager to manage your Android SDK versions.

:heavy_multiplication_x: You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: ‘>=23 <=27’.
Run $ sdkmanager from your command-line to install required Android Build Tools. In case you already have them installed, make sure ANDROID_HOME environment variable is set correctly.

:heavy_multiplication_x: You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ sdkmanager to manage the Android Support Repository. In case you already have it installed, make sure ANDROID_HOME environment variable is set correctly.

:heavy_multiplication_x: Error executing command ‘javac’. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable.
You will not be able to build your projects for Android.
To be able to build for Android, verify that you have installed The Java Development Kit (JDK) and configured it according to system requirements as
described in setup/ns-cli-setup/ns-setup-linux.html#system-requirements

:heavy_multiplication_x: WARNING: The Java Development Kit (JDK) is not installed or is not configured properly.
You will not be able to work with the Android SDK and you might not be able
to perform some Android-related operations. To ensure that you can develop and
test your apps for Android, verify that you have installed the JDK as
described in javase/8/docs/technotes/guides/install/install_overview.html (for JDK 8).

You have nativescript-cloud extension installed, so you can execute cloud builds, but your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options:
Select “Configure for Local Builds” to run the setup script and automatically configure your environment for local builds.
Select “Skip Step and Configure Manually” to disregard this option and install any required components manually.
You have nativescript-cloud extension installed, so you can execute cloud builds, but your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options:
Select “Configure for Local Builds” to run the setup script and automatically configure your environment for local builds.
Select “Skip Step and Configure Manually” to disregard this option and install any required components manually.
? To continue, choose one of the following options: (Use arrow keys)
❯ Try Cloud Operation
Configure for Local Builds
Skip Step and Configure Manually

But I have done the steps mentioned here clearly.

echo $JAVA_HOME
/home/username/Downloads/android-studio/jre

echo $ANDROID_HOME
/home/username/Android/Sdk/

android command works from the command line .

$ android


The “android” command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager


Invalid or unsupported command “”

Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk

I am not sure what exactly is wrong. I dont want to use the NativeScript cloud, I want local builds.

Can someone pointout what am I missing.

PS : I have removed the links from the trace log,since discourse only allows 2 links per post for a new user


#2

Make sure you have android SDK version <=27.


#3

It is in V27already. I have re-verified it also


#4

Your JAVA_HOME pointing to JRE or JDK? looks like jre


#5

Solved the issue and good now.
Crazily, the fix was adding this to my bashrc

export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

Note : I replaced /home/username/ with $HOME and magically all works. Very weird