question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detect Android SDK using ANDROID_SDK_ROOT env var

See original GitHub issue

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 7.0.7
  • Cross-platform modules:
  • Android Runtime:
  • iOS Runtime:
  • Plugin(s):

Describe the bug

On running the command ns doctor, I get this message

× 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.

However, I have the ANDROID_SDK_ROOT env var set which is equivalent to ANDROID_HOME.

To Reproduce

Run ns doctor

Expected behavior I expected it to detect the Android SDK using the ANDROID_SDK_ROOT env var.

Sample project

Additional context

https://developer.android.com/studio/command-line/variables#envar

The ANDROID_HOME env var is deprecated. Refer to the link above.


Please guide me on how to fix this.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rigor789commented, Oct 1, 2020

You could pack the doctor package with npm pack and in the CLI npm install /path/to/nativescript-doctor....tgz.

Not sure how you are running the CLI, the quickest way that I’ve been using lately is npx grunt watch:ts and then run the CLI with the full path to it /path/to/nativescript-cli/bin/nativescript.js doctor for example.

1reaction
rigor789commented, Sep 20, 2020

Either way is fine, don’t think it matters too much.

Just to keep it as it is now, look for ANDROID_HOME and then fall back to ANDROID_SDK_ROOT for now - we can always switch this out in the future if we need to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where is android_sdk_root? and how do I set it.?
You need to make a system env variable with the name: ANDROID_SDK_ROOT and it's value should be C:\Users\your_user_name\AppData\Sdk\tools\bin worked for me.
Read more >
Environment variables - Android Developers
Learn how to set environment variables for Android Studio and the command-line tools that specify things like where the SDK is installed and ......
Read more >
Android SDK and Emulator
To manually set the Android environment variables for a Mac computer, do the following: In the home directory, locate .bash_profile , and then...
Read more >
How to Set Path Environmental Variable for SDK in Windows?
Put ANDROID_HOME as Variable name and provide the path of the SDK ... This will open the Android SDK Manager dialog box, as...
Read more >
Specify a path to Android SDK root folder - Katalon Docs
You can rename or move your Android SDK root folder to another location and use the ANDROIDHOME environment variable to point the path...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found