docs-v7
docs-v7 copied to clipboard
Step 6 of installation doesn't work, solution on StackOverflow
Make sure to check the existing issues in this repository
Please, tell us what's the problem?
[ ] A typo [ ] Wrong documentation [ x] Improvement of existing article [ ] Missing documentation [ ] New article needed
Please, tell us more details
Step 6 of installation doesn't work:
sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"
We will receive error:
Warning: Could not create settings
java.lang.IllegalArgumentException
The way we set up variables for sdkmanager is wrong, tested with 'commandlinetools-linux-6514223_latest.zip'. Correct solution to access sdkmanager found here: https://stackoverflow.com/a/61150826 except step 10 of Stackoverflow's answer, but it doesn't matter. You can check sdkmanager's version with:
user@user-VirtualBox:/usr/lib/android-sdk/cmdline-tools/tools/bin$ ./sdkmanager --version
where user@user-VirtualBox:
is my Ubuntu VM 19.10. You can create symlink to access sdkmanager without full path:
sudo ln -s /usr/lib/android-sdk/tools/bin/sdkmanager /usr/local/bin
and for avdmanager:
sudo ln -s /usr/lib/android-sdk/tools/bin/avdmanager /usr/local/bin
I was able to process with step 6 of NativeScript installation with the following command after steps from Stackoverflow:
user@user-VirtualBox:/usr/lib/android-sdk/cmdline-tools/tools/bin$ sudo ./sdkmanager "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"
Also in file .bashrc
variable ANDROID_HOME
must look like this:
export ANDROID_HOME="/usr/lib/android-sdk/"
When everything is done correctly my variables in .bashrc look like this:
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
export ANDROID_HOME="/usr/lib/android-sdk/"
export PATH="${PATH}:${ANDROID_HOME}tools/:${ANDROID_HOME}platform-tools/"
export ANDROID_SDK_ROOT=/usr/lib/android-sdk
export PATH="$PATH:$JAVA_HOME"
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
can't be export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')
because it will always point to a newest version, if you have done system upgrade.
running tns doctor
will be successfull:
user@user-VirtualBox:~$ tns doctor
✔ Getting environment information
No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ 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.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.7.4 version and is up to date.