Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android SDK is not installed or is not configured properly, environment looks ok. #1813

Closed
krystan opened this issue Jun 7, 2016 · 27 comments

Comments

@krystan
Copy link

commented Jun 7, 2016

First of all, I am very new to Nativescript. I am in the process of trying to set it up on windows 10. I have all the tools installed as far as I can tell and have made sure my android environment is setup. When I type android at the cli I get the sdk manager and have them installed (sdk build tools etc).

Java is at version 1.7.0_55 on my box and that seems fine. What is not fine is that Nativescript insists my ANDROID_HOME is not set or is invalid.

I have run a doctor script which I include (attached)
log.txt

I looked at the first error which was adb help and I ran that command directly from the same shell I got the following output from adb.exe

adbout.txt

The reason I am filing this issue is because I receive an errror when trying to add a platform using

tns platform add android

When I issue this command I get the following 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.

This appears not to be the case. And so I am filing an issue as I cannot add the android platform to my app.

@krystan krystan changed the title Android SDK is not installed or is not configured properly Android SDK is not installed or is not configured properly, environment looks ok. Jun 7, 2016

@enchev

This comment has been minimized.

Copy link
Contributor

commented Jun 8, 2016

Java 1.7 is already deprecated. Can you try to update to latest to see if the problem will go away?

You can check {N} system requirements here:
https://github.com/NativeScript/nativescript-cli#system-requirements

@dtopuzov

This comment has been minimized.

Copy link
Member

commented Jun 8, 2016

First you need Java 1.8.

Re ANDROID_HOME, can you try this: echo %ANDROID_HOME%
Also after installing Android SDK you need to install those things:
Android SDK 22 or a later stable official release
Android SDK Build-tools 23.0.0 or a later stable official release
Local Maven repository for Support Libraries

@krystan

This comment has been minimized.

Copy link
Author

commented Jun 8, 2016

Ok so I updated java to the latest jdk and unfortunately that has not sorted the issue I include everything I can think of to help diagnose.

tnsver.txt
tnsdoc.txt
nodever.txt
npmver.txt

androidenv.txt
doctorout.txt

@krystan krystan closed this Jun 8, 2016

@krystan krystan reopened this Jun 8, 2016

@krystan

This comment has been minimized.

Copy link
Author

commented Jun 8, 2016

I should point out that my android_home points to:

"c:\program files (x86)\Android\android sdk"

which is where the sdk is installed :)

@krystan

This comment has been minimized.

Copy link
Author

commented Jun 8, 2016

I have gone back and looked at this, and I suddenly realised the base tools were installed by visual studio. What I did was to uninstall android dev kit and reinstall using android studio, I updated android home to the location studio was using and doctor is now satisfied.

@krystan krystan closed this Jun 8, 2016

@tonyawad88

This comment has been minimized.

Copy link

commented Jul 27, 2016

I have the same issue on Windows. My nativescript installs successfully but when I run tns doctor I get the following:

WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the nati
ve emulator.
To be able to build for Android and run apps in the native emulator, verify that
 you have
installed the latest Android SDK and its dependencies as described in http://dev
eloper.android.com/sdk/index.html#Requirements

TIP: To avoid setting up the necessary environment variables, you can use the ch
ocolatey package manager to install the Android SDK and its dependencies.

NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or
 later.

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

You need to have Android SDK 22 or later and the latest Android Support Reposito
ry installed on your system.
Run $ android  to manage the Android Support Repository

I have many 22+ SDKs available and installed. Could it be the location ?

Running echo %ANDROID_HOME% gets me this:
P:\>echo %ANDROID_HOME% C:\Users\aawad\AppData\Local\Android\android-sdk

Also running the following:
P:>echo %ANDROID_HOME%
C:\Users\UID\AppData\Local\Android\android-sdk

P:>javac -version
javac 1.8.0_102

P:>java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Any suggestions ?
Thank you !

@tjvantoll

This comment has been minimized.

Copy link
Contributor

commented Jul 29, 2016

I’m having basically the exact same issue as @tonyawad88. The installation script ran successfully, and everything is set up, but tns doctor spits out what appear to be false positive messages about Android SDK issues.

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

You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ android  to manage the Android Support Repository.
@hnguyenec

This comment has been minimized.

Copy link

commented Aug 5, 2016

it is turned out that: setting ANDROID_HOME to "c:\program files (x86)\Android\android sdk" as in the tutorial is the one causing this issue.
You should change it to C:\Users\UID\AppData\Local\Android\android-sdk
then in command line, type refreshenv
After that, everything should be ok

@tjvantoll

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2016

@hnguyenec I assume you’re referring to this article that needs to be updated, correct? https://github.com/NativeScript/docs/blob/production/start/ns-setup-win.md

We should definitely update the docs, but I think there’s still a problem in the script, as when I ran through this it set my ANDROID_HOME to an incorrect location.

@naveedahmed1

This comment has been minimized.

Copy link

commented Oct 25, 2016

Any update on this? I am having the exact same issue as pointed out by @tonyawad88 and @tjvantoll

@ics042

This comment has been minimized.

Copy link

commented Nov 7, 2016

I encountered the same issue with @tonyawad88 and @tjvantoll, finally, I changed the environment Variable ANDROID_HOME to a real Android SDK directory(installed android manually), then run tns doctor, it showed No issues were detected.
The default ANDROID_HOME was set to C:\Users\Uid\AppData\Local\Android\android-sdk after Nativescript set up script running, I assume this is not a whole Android SDK directory, so such info was shown.

@hamedgol

This comment has been minimized.

Copy link

commented Dec 11, 2016

Hi i have @tonyawad88 and @tjvantoll same problem and my sdk path in folder d: and i can not find any \android-sdk in C:\Users\Uid\AppData\Local\Android\android-sdk path

@harmonyc

This comment has been minimized.

Copy link

commented Dec 13, 2016

Remove the User Variable
Add the System Variable ANDROID_HOME
Point the System Variable to C:\Program Files (x86)\Android\android-sdk
Exit prompt and Open new Prompt and try again

@LuisGhz

This comment has been minimized.

Copy link

commented Jul 25, 2017

After install.
ANDROID_HOME = C:\Users\Usr\AppData\Local\Android\android-sdk
but the route not exist, i access to C:\Users\Usr\AppData\Local\Android and i can see the folder sdk so i change.
ANDROID_HOME = C:\Users\Usr\AppData\Local\Android\sdk
and it works

@Rombersoft

This comment has been minimized.

Copy link

commented Aug 15, 2017

I try do it on linux
export ANDROID_HOME='/media/destructor/Media/Install/Linux/android-sdk-linux/'
but get next warnings
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 build your projects for Android and run them in the native emulator.
To be able to build for Android and run apps in the native emulator, verify that you have
installed the latest Android SDK and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements

NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later.

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.

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.

You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=26'.
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.

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.

@ItStillDoesNotWork

This comment has been minimized.

Copy link

commented Sep 21, 2017

Can only confirm @Rombersoft 's comment. This does not work on Linux. It's about what I've come to expect of Android toolchain stuff, but it's still appalling.

@bboydflo

This comment has been minimized.

Copy link

commented Sep 22, 2017

I have the same problem, on mac :(

@ssimpo

This comment has been minimized.

Copy link

commented Feb 2, 2018

Not sure if this helps anyone but I had the same issue on Linux (Ubuntu) after issuing:

sudo npm install nativescript -g --unsafe-perm

However, in the end I realised it was my environment variables not being carried forward to sudo. Once, I added:

Defaults env_keep += "ANDROID_HOME JAVA_HOME"

to the bottom of /etc/sudoers it worked perfectly.

@cizu64

This comment has been minimized.

Copy link

commented Feb 8, 2018

@LuisGhz It worked like charm. I think NativeScript is looking for the SDK path "C:\Users\Usr\AppData\Local\Android\sdk" which i set as the "ANDROID_HOME" environment variable, not this "C:\Usr\Android\android-sdk" . I have spent my time download un-necessary packages.

@edenmanny25

This comment has been minimized.

Copy link

commented Mar 25, 2018

installing sidekick solved my issue

@divyachandana

This comment has been minimized.

Copy link

commented Oct 15, 2018

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

@ll931217

This comment has been minimized.

Copy link

commented Feb 18, 2019

I fixed this issue by setting ANDROID_HOME to $HOME/Android/Sdk

@franconeil

This comment has been minimized.

Copy link

commented Apr 22, 2019

how do you set ANDROID_HOME to $HOME/Android/Sdk?

@NickIliev

This comment has been minimized.

Copy link
Member

commented Apr 23, 2019

@franconeil check this answers for setting ANDROID_HOME on Ubuntu Linux. As the originally reported issue was for setting on Windows and the last conversation threads are talking about Linux I am going to close the issue as resolved. If you have difficulties setting the ANDROID_HOME on linux please check the existing threads or open a new issue related to the Linux setup.

@NickIliev NickIliev closed this Apr 23, 2019

@ll931217

This comment has been minimized.

Copy link

commented Apr 24, 2019

how do you set ANDROID_HOME to $HOME/Android/Sdk?

Enter this in your terminal

export ANDROID_HOME=$HOME/Android/Sdk

The above command only set it temporary, if you want it set every time you boot, then add that line to either ~/.zshrc or ~/.bashrc, depending on what shell you are using.

@chamodKanishka

This comment has been minimized.

Copy link

commented Apr 30, 2019

I found the error. We must add android & java home paths to system variables. Not user variables. Finally I fixed the issue

@rosen-vladimirov rosen-vladimirov added this to Done in CLI Team May 15, 2019

@jagadish-kb

This comment has been minimized.

Copy link

commented Jun 6, 2019

On Mac, i had the same issue and this arises because the ANDROID_H

I have the same problem, on mac :(

set ANDROID_HOME to /Users/$userid/Library/Android/sdk/ as opposed to '/usr/local/share/android-sdk/' as mentioned in this {N} documentation which must be updated.

jagadish-kb added a commit to jagadish-kb/docs that referenced this issue Jun 6, 2019

Updated ANDROID_HOME env variable value
ANDROID_HOME env value if set as per documentation mentioned [here](NativeScript/nativescript-cli#1813) does not work always. So updating that part as per the solution found.
@jagadish-kb jagadish-kb referenced this issue Jun 6, 2019
1 of 2 tasks complete

NickIliev added a commit to NativeScript/docs that referenced this issue Jul 31, 2019

Updated ANDROID_HOME env variable value (#1684)
ANDROID_HOME env value if set as per documentation mentioned [here](NativeScript/nativescript-cli#1813) does not work always. So updating that part as per the solution found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
You can’t perform that action at this time.