3

I've noticed there's no quick way of installing and configuring all nativescript dependencies on linux like windows and mac, so I followed the advanced setup guide for linux and all the commands ran successfully, however, when running tns doctor it tells me that android sdk is not installed or not configured correctly. everything else is giving me green check marks here is what I did

  1. Download android sdk
  2. Extract it to /usr/local/android/sdk/
  3. changed java version back to 8 since i had version 10 installed
  4. run sudo sdkmanager "tools", sudo sdkmanager "build-tools" etc.
  5. Made sure that the sdkmanager command is accessible without sudo

yet it doesn't work and I don't know why. any help please and thanks in advance.

here is the output of tns doctor

✔ Getting environment information 

There seem to be issues with your configuration.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.3.0 version and is up to date.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly 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.
✖ WARNING: The Android SDK is not installed or is not configured properly. 
 You will not be able to run your apps in the native emulator. To be able to run apps
in the native Android emulator, verify that you have installed the latest Android SDK 
and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements 

You are missing the nativescript-cloud extension and you will not be able to execute cloud builds. 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 "Sync to Playground" to enjoy NativeScript without any local setup. All you need is a couple of companion apps installed on your devices.
Select "Configure for Cloud Builds" to install the nativescript-cloud extension and automatically configure your environment for cloud builds.
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.
Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.

Edit: here are the lines I've added to my ~/.bashrc file.

export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')

export ANDROID_HOME="/usr/local/android/sdk"

export PATH="$PATH:$ANDROID_HOME/tools/:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/tools/bin"

also here is the first part of the output of $ sdkmanager --list

Warning: File /home/mahmoud/.android/repositories.cfg could not be loaded.      
Installed packages:=====================] 100% Computing updates...             
  Path                        | Version | Description                    | Location                    
  -------                     | ------- | -------                        | -------                     
  build-tools;28.0.3          | 28.0.3  | Android SDK Build-Tools 28.0.3 | build-tools/28.0.3/         
  extras;android;m2repository | 47.0.0  | Android Support Repository     | extras/android/m2repository/
  extras;google;m2repository  | 58      | Google Repository              | extras/google/m2repository/ 
  patcher;v4                  | 1       | SDK Patch Applier v4           | patcher/v4/                 
  platform-tools              | 29.0.5  | Android SDK Platform-Tools     | platform-tools/             
  platforms;android-28        | 6       | Android SDK Platform 28        | platforms/android-28/       
  tools                       | 26.1.1  | Android SDK Tools 26.1.1       | tools/ 
2
  • Did you open SDK manager and install required / latest packages & api levels? Commented Jan 2, 2020 at 3:03
  • @Manoj if you mean step four in my question then yes, I did. please note that I have the sdk installed but not android studio Commented Jan 2, 2020 at 8:30

2 Answers 2

1

Look at this link for nativescript setup in ubuntu system. Because I am already follow that link for setup. https://docs.nativescript.org/start/ns-setup-linux. Focus on step 5 for android sdk installation and anroid sdk path set in environment variable in ~/.bashrc file.

Sign up to request clarification or add additional context in comments.

4 Comments

I have mentioned in my question that I have followed this guide.``` export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *(.*)\/bin\/javac/\1/p') export ANDROID_HOME="/usr/local/android/sdk" export PATH="$PATH:$ANDROID_HOME/tools/:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/tools/bin"```
I just wish there was a way to get a more informative error message. just to know what's wrong. do you have any ideas?
Set path like:- export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools And Install all tools using command :- sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"
I have already done that as you can see in my question. I have included the last few lines of my bashrc file in the question
0

I had the same adventure:

Please consider & try the below: 1) Make sure you haven't edited the sdkmanager script, with the line:

DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'

In case you did replace it with:

DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME"'

Then try something like:

$ANDROID_HOME/tools/bin/sdkmanager "build-tools;29.0.0"

and if all goes well, then the final check:

tns doctor

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.