Skip to content

The Android SDK isn't installed or it's not configured properly #3585

Closed

Description

@pierreamgabriel

So, I'm definitely moving from Windows 7 to Linux Mint 18.3. I followed all the necessary steps to get NS running as described here https://docs.nativescript.org/start/ns-setup-linux.

When I run tns run android, this is the output:

✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ 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: 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 http://developer.android.com/sdk/index.html#Requirements 

✖ 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

i'm pretty sure the Android SDK is installed.

Activity

  1. Fatme commented on May 15, 2018

    @Fatme
    Contributor

    Hi @pierremacedo,

    It seems your adb is not included in $PATH. {N} CLI tries to execute $ANDROID_HOME\platform-tools\adb to check if adb is correctly setup. To check it on your side, just execute adb from command line.

    To include it in $PATH you can use

    export PATH=$PATH:$ANDROID_HOME/platform-tools/adb
    
  2. pierreamgabriel commented on May 15, 2018

    @pierreamgabriel
    Author

    @Fatme Thank you but it didn't help and I just found out another problem: NS seems not to recognize the ANDROID_HOME variable set int .bashrc, because as soon as I restart the computer and run tns doctor it tells me the variable isn't set, but it in fact is, since I get this output bash: /home/pierre/android/sdk/: Is a directory when I run $ANDROID_HOME

  3. Fatme commented on May 15, 2018

    @Fatme
    Contributor

    Hi @pierremacedo,

    {N} CLI gets ANDROID_HOME from process environment. There is no logic to check .bashrc or some other profile files.

    process.env["ANDROID_HOME"]
    

    Can you please confirm that you execute tns run command and $ANDROID_HOME from the same terminal?

  4. Fatme commented on May 15, 2018

    @Fatme
    Contributor

    Hi @pierremacedo,

    Another thing we would like to ask you is to execute the following:

    echo $ANDROID_HOME && tns doctor
    
  5. pierreamgabriel commented on May 15, 2018

    @pierreamgabriel
    Author

    @Fatme So now the variable and paths are permanently in environment, so no more warnings saying ANDROID_HOME isn't set.

    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/pierre/android/sdk/tools:/home/pierre/android/sdk/platform-tools:/home/pierre/android/sdk/platform-tools/adb"
    
    ANDROID_HOME=/home/pierre/android/sdk/
    

    tns run:

    ✔ Your ANDROID_HOME environment variable is set and points to correct directory.
    ✔ 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: 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 http://developer.android.com/sdk/index.html#Requirements 
    
    ✖ 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 
    

    $ANDROID_HOME:
    bash: /home/pierre/android/sdk/: Is a directory

    echo $ANDROID_HOME && tns doctor:

    /home/pierre/android/sdk/
    ✔ Getting environment information 
    
    ✔ Your ANDROID_HOME environment variable is set and points to correct directory.
    ✔ 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: 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 http://developer.android.com/sdk/index.html#Requirements 
    
    ✖ 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 
    
    There seem to be issues with your configuration.
    ✔ Getting NativeScript components versions information...
    ✔ Component nativescript has 4.0.1 version and is up to date.
    ✔ Component tns-core-modules has 4.0.0 version and is up to date.
    ✖ Component tns-android is not installed.
    ✖ Component tns-ios is not installed.
    ✔ Your ANDROID_HOME environment variable is set and points to correct directory.
    ✔ 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: 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 http://developer.android.com/sdk/index.html#Requirements 
    
    ✖ 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 
    
    
    
  6. Fatme commented on May 16, 2018

    @Fatme
    Contributor

    Hi @pierremacedo,

    I've noticed your $PATH has /home/pierre/android/sdk/tools but it seems you need /home/pierre/android/sdk/tools/bin. Not sure this will resolve your issue but can you please try it:

    export PATH=$PATH:$ANDROID_HOME/tools/bin
    

    After that can you please execute

    adb && tns doctor
    
  7. Fatme commented on May 16, 2018

    @Fatme
    Contributor

    Hi @pierremacedo,

    We discussed your problem and actually there are 2 scenarios that might cause this issue.
    The first one is in case when android sdk is not fully installed or configured. To verify it, can you please execute

    ls -la $ANDROID_HOME/platform-tools/adb
    

    The second one is in case when adb server is already running. If this is the case, you need to kill the server. You can use the following:

    $ANDROID_HOME/platform-tools/adb kill-server
    
  8. pierreamgabriel commented on May 17, 2018

    @pierreamgabriel
    Author

    @Fatme I think it was probably because I was using Linux 32-bit and google doesn't support this architecture but I didn't know that. But now I'm using a 64-bit Debian and I can't even install the required runtime libraries, so I'm definitely giving up on NS and moving to React Native. Thanks for your help.

  9. rosen-vladimirov commented on May 17, 2018

    @rosen-vladimirov
    Contributor

    Hey @pierremacedo,
    My name is Rosen Vladimirov and I'm working on NativeScript since its beginning. I'm sorry to hear you have faced issues with the environment configuration and this led you to the decision to stop using the technology. In fact configuring the environment for both iOS and Android builds is not an easy task and as you have seen, we are still struggling with different issues on this side. However, the technology itself, the NativeScript framework, is really powerful. I'm not sure if you were able to give it a try, so I would like to suggest you to take a look at the following resources, which could give you another way to try NativeScript:

    • NativeScript Playground: https://play.nativescript.org - the Playground allows you to try the NativeScript framework with a minimum efforts. You have to download the required application from AppStore (PlayStore) and scan a QR code to deploy your app. In fact NativeScript Playground is the easiest and fastest way to try the technology itself.
    • NativeScript Sidekick: https://www.nativescript.org/nativescript-sidekick - This Desktop application allows you to create, build and run NativeScript applications without any local configuration. The only requirements are to have NativeScript CLI installed and to have a Telerik account. NativeScript Sidekick allows you to use cloud builds (you have 100 free cloud builds each month) and local builds in case your local environment is setup.

    Once again I'm sorry to hear you have faced issues with the configuration. We'll be glad to assist you further in case you would like to give it a try.

  10. IAMtheIAM commented on Aug 2, 2018

    @IAMtheIAM

    If you are switching between platforms like Windows, Linux, and Mac - then you'll need the platform-tools appropriate for each platform aka on windows it is adb.exe and on linux it is adb - so get the platform tools for each platform from here and put them all in the same folder

    As long as ANDROID_HOME points to the root of the sdk folder, it will work.

  11. divyachandana commented on Oct 15, 2018

    @divyachandana

    updating SDK in AndroidStudio >> Preferences would help
    screen shot 2018-10-16 at 3 25 26 am

  12. WayneDV commented on Dec 30, 2018

    @WayneDV

    I have the same problem, and find that "sudo tns doctor" works fine - even though I installed everything in my non-privileged user's home folder. (SDKs, npm modules, nativescript, etc)

  13. eugenefvdm commented on Feb 23, 2019

    @eugenefvdm

    I ran into this problem. I tried following this advice:

    eugene@fintechsystems:/$ ls -la $ANDROID_HOME/platform-tools/adb

    but I get:
    ls: cannot access '~/Android/Sdk/platform-tools/adb': No such file or directory

    Then I skip using the environment variable and specify the hard path:
    eugene@fintechsystems:/$ ls -la /home/eugene/Android/Sdk/platform-tools/adb
    -rwxrwxr-x 1 eugene eugene 2704537 Feb 23 22:37 /home/eugene/Android/Sdk/platform-tools/adb

    That works! Really confused so I changed directory using the environment which also works!

    eugene@fintechsystems:/$ cd /Android/Sdk/platform-tools/
    eugene@fintechsystems:
    /Android/Sdk/platform-tools$ ls -ls adb
    2644 -rwxrwxr-x 1 eugene eugene 2704537 Feb 23 22:37 adb

    So to fix the problem instead of using ~/Android/Sdk I've just hard coded /home/eugene/Android/Sdk and now tns doctor works!

  14. Fatme commented on Feb 23, 2019

    @Fatme
    Contributor

    What is the output of echo ~?

  15. eugenefvdm commented on Feb 23, 2019

    @eugenefvdm

    eugene@fintechsystems:~$ echo ~
    bash: /home/eugene: Is a directory

  16. zleight1 commented on Jun 28, 2019

    @zleight1

    Hopefully this will help someone, on my machine all the Android SDKs/ADB were installed in my /Users folder (probably because I already had Android Studio installed).

    I fixed it by setting the Android home path to point to the /Users/ sdk by running:

    export ANDROID_HOME=/Users/zleighton/Library/Android/sdk

    After that tns doctor reported everything OK.

  17. Danielhoifodt commented on Jul 15, 2019

    @Danielhoifodt

    Hi, i can not find the path where sdk and build tools are installed. I think they were installed on a wrong directory. i get the same problems as above. How can i find where sdk is installed?

  18. mahmoudyusof commented on Jan 2, 2020

    @mahmoudyusof

    I also have a problem with sdk configuration. the adb is installed and configured correctly, and I have added all the needed paths to the $PATH env variable, I have no idea what the problem is
    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.
    

    here are the edits I made to my ~/.bashrc file as well.

    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"
    
  19. gabrielg-dev commented on Feb 10, 2020

    @gabrielg-dev

    I have another nativescript project on same pc and that run without problem, but nativescript-oauth2 github angular example show always "The setup script was not able to configure your environment for local builds"

    Update (edit):

    I just installed sdk build tools 29.0.3, 28.0.3 and 27.0.3 using sdkmanager and now it works.

  20. gajanannaik commented on Jun 30, 2020

    @gajanannaik

    s1
    When i tried to run tns doctor i got this error help me please!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions