The ANDROID_HOME environment variable is not set
See original GitHub issueI am receiving the following message when I try to add the Android platform:
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.
When I run echo $ANDROID_HOME
on my Mac, it prints out the following:
/Users/nraboy/Library/Android-SDK
I validate this path by executing cd $ANDROID_HOME
followed by a ls
and everything seems normal.
My Android installation is valid because it works fine with React Native, Ionic Framework, and native Android development.
Here is the process I used for installing NativeScript on my machine:
sudo curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
nvm install 0.12.7
nvm use 0.12.7
sudo npm install -g nativescript
Yes, I am using NVM to manage my Node.js versions.
Here are my full --log trace
for Android:
$ tns platform add android --log trace
Exec uname -a
stdout: Darwin macbookpro 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
stderr:
Exec npm -v
stdout: 2.11.3
stderr:
spawn: java -version
Exec node-gyp -v
stdout:
stderr: /bin/sh: node-gyp: command not found
Exec xcodebuild -version
stdout: Xcode 7.0.1
Build version 7A1001
stderr:
Exec pod --version
stdout:
stderr: /bin/sh: pod: command not found
Exec adb version
stdout: Android Debug Bridge version 1.0.32
Revision eac51f2bb6a8-android
stderr:
Exec android -h
stdout:
Usage:
android [global options] action [action options]
Global options:
-h --help : Help on a specific command.
-v --verbose : Verbose mode, shows errors, warnings and all messages.
--clear-cache: Clear the SDK Manager repository manifest cache.
-s --silent : Silent mode, shows errors only.
Valid
actions
are
composed
of a verb
and an
optional
direct
object:
- sdk : Displays the SDK Manager window.
- avd : Displays the AVD Manager window.
- list : Lists existing targets or virtual devices.
- list avd : Lists existing Android Virtual Devices.
- list target : Lists existing targets.
- list device : Lists existing devices.
- list sdk : Lists remote SDK repository.
- create avd : Creates a new Android Virtual Device.
- move avd : Moves or renames an Android Virtual Device.
- delete avd : Deletes an Android Virtual Device.
- update avd : Updates an Android Virtual Device to match the folders
of a new SDK.
- create project : Creates a new Android project.
- update project : Updates an Android project (must already have an
AndroidManifest.xml).
- create test-project : Creates a new Android project for a test package.
- update test-project : Updates the Android project for a test package (must
already have an AndroidManifest.xml).
- create lib-project : Creates a new Android library project.
- update lib-project : Updates an Android library project (must already have
an AndroidManifest.xml).
- create uitest-project: Creates a new UI test project.
- update adb : Updates adb to support the USB devices declared in the
SDK add-ons.
- update sdk : Updates the SDK by suggesting new platforms to install
if available.
stderr:
Exec mono --version
stdout: Mono JIT compiler version 4.0.2 ((detached/c99aa0c Thu Jun 11 18:53:01 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-(detached/a173357)
GC: sgen
stderr:
Exec git --version
stdout: git version 2.3.8 (Apple Git-58)
stderr:
Exec gradle -v
stdout:
------------------------------------------------------------
Gradle 2.4
------------------------------------------------------------
Build time: 2015-05-05 08:09:24 UTC
Build number: none
Revision: 5c9c3bc20ca1c281ac7972643f1e2d190f2c943c
Groovy: 2.3.10
Ant: Apache Ant(TM) version 1.9.4 compiled on April 29 2014
JVM: 1.7.0_79 (Oracle Corporation 24.79-b02)
OS: Mac OS X 10.10.5 x86_64
stderr:
Exec javac -version
stdout:
stderr: javac 1.7.0_79
System information:
{ procInfo: 'nativescript/1.4.2',
platform: 'darwin',
os: 'Darwin macbookpro 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64\n',
shell: '/bin/bash',
dotNetVer: null,
procArch: 'x64',
nodeVer: 'v0.12.7',
npmVer: '2.11.3',
javaVer: '1.7.0',
nodeGypVer: null,
xcodeVer: 'Xcode 7.0.1\nBuild version 7A1001\n',
itunesInstalled: true,
cocoapodVer: null,
adbVer: 'Android Debug Bridge version 1.0.32',
androidInstalled: true,
monoVer: '4.0.2',
gitVer: '2.3.8 (Apple Git-58)',
gradleVer: '2.4',
javacVersion: '1.7.0_79' }
Initializing analytics statuses.
Analytics statuses:
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'platform'.
AnalyticsInstallationID: f137150b-da8f-4e4c-b8bf-0553dd8d46ed
monitor not started
monitor not started
monitor has started, connecting to http://5752dabccfc54c4ab82aea9626b7338e.monitor-eqatec.com/json.ashx
BeforeHookName for command platform-add is before-platform-add
AfterHookName for command platform-add is after-platform-add
Looking for project in '/Users/nraboy/Desktop/nsproject'
Project directory is '/Users/nraboy/Desktop/nsproject'.
spawn: adb version
Statistics was sent successfully (xhr).
Analytics statuses:
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'platform|add'.
BeforeHookName for command platform|add is before-platform
AfterHookName for command platform|add is after-platform
Statistics was sent successfully (xhr).
Statistics was sent successfully (xhr).
Exec android list targets
stdout: Available Android targets:
----------
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 4
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a, default/x86
----------
id: 2 or "android-20"
Name: Android 4.4W.2
Type: Platform
API level: 20
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
Tag/ABIs : android-wear/armeabi-v7a, android-wear/x86
----------
id: 3 or "android-21"
Name: Android 5.0.1
Type: Platform
API level: 21
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 4 or "android-22"
Name: Android 5.1.1
Type: Platform
API level: 22
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 5 or "android-MNC"
Name: Android M (Preview)
Type: Platform
API level: MNC
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 6 or "android-23"
Name: Android 6.0
Type: Platform
API level: 23
Revision: 1
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 7 or "Google Inc.:Glass Development Kit Preview:19"
Name: Glass Development Kit Preview
Type: Add-On
Vendor: Google Inc.
Revision: 11
Description: Preview of the Glass Development Kit
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.glass (gdk.jar)
APIs for Glass Development Kit Preview
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 8 or "Google Inc.:Google APIs:19"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 16
Description: Android + Google APIs
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a
----------
id: 9 or "Google Inc.:Google APIs (x86 System Image):19"
Name: Google APIs (x86 System Image)
Type: Add-On
Vendor: Google Inc.
Revision: 16
Description: Android x86 + Google APIs
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/x86
----------
id: 10 or "Google Inc.:Google APIs:21"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 5.0.1 (API level 21)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64
----------
id: 11 or "Google Inc.:Google APIs:22"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 5.1.1 (API level 22)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64
----------
id: 12 or "Google Inc.:Google APIs:23"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 6.0 (API level 23)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
stderr:
Creating NativeScript project for the android platform
Path: /Users/nraboy/Desktop/nsproject/platforms/android
Package: org.nativescript.nsproject
Name: nsproject
Copying template files...
Using version 1.4.0.
Shasum of file /Users/nraboy/.npm/tns-android/1.4.0/package.tgz is db6759935a327b63ca20d175a8ef82a3ee7e915a
Checking shasum of package: tns-android@1.4.0: expected db6759935a327b63ca20d175a8ef82a3ee7e915a, actual db6759935a327b63ca20d175a8ef82a3ee7e915a.
Exec android list targets
stdout: Available Android targets:
----------
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 4
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a, default/x86
----------
id: 2 or "android-20"
Name: Android 4.4W.2
Type: Platform
API level: 20
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
Tag/ABIs : android-wear/armeabi-v7a, android-wear/x86
----------
id: 3 or "android-21"
Name: Android 5.0.1
Type: Platform
API level: 21
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 4 or "android-22"
Name: Android 5.1.1
Type: Platform
API level: 22
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 5 or "android-MNC"
Name: Android M (Preview)
Type: Platform
API level: MNC
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 6 or "android-23"
Name: Android 6.0
Type: Platform
API level: 23
Revision: 1
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 7 or "Google Inc.:Glass Development Kit Preview:19"
Name: Glass Development Kit Preview
Type: Add-On
Vendor: Google Inc.
Revision: 11
Description: Preview of the Glass Development Kit
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.glass (gdk.jar)
APIs for Glass Development Kit Preview
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 8 or "Google Inc.:Google APIs:19"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 16
Description: Android + Google APIs
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a
----------
id: 9 or "Google Inc.:Google APIs (x86 System Image):19"
Name: Google APIs (x86 System Image)
Type: Add-On
Vendor: Google Inc.
Revision: 16
Description: Android x86 + Google APIs
Based on Android 4.4.2 (API level 19)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/x86
----------
id: 10 or "Google Inc.:Google APIs:21"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 5.0.1 (API level 21)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64
----------
id: 11 or "Google Inc.:Google APIs:22"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 5.1.1 (API level 22)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64
----------
id: 12 or "Google Inc.:Google APIs:23"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 6.0 (API level 23)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
stderr:
Selected targetSdk is: 23
Selected AppCompat version is: undefined
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.
Any suggestions appreciated.
Thanks,
Issue Analytics
- State:
- Created 8 years ago
- Comments:37 (7 by maintainers)
Top Results From Across the Web
Error: ANDROID_HOME is not set and "android" command not ...
Go to system properties. · Click change setting. · Click advance tab. · Click Environment Variables button. · In system variables area click...
Read more >The ANDROID_HOME environment variable is not set for the ...
Another possible workaround is to set it as a variabel on the build definition itself. We are using Azure DevOps Server 2019.1. 1...
Read more >Set Android_Home Environment Variable in Windows 10
To set up the Android Environment variable on Windows, you first required to have Android installation path with you.
Read more >How to Set Path Environmental Variable for SDK in Windows?
Set ANDROID_HOME and Path Variables ; Prerequisite: ; Step 1. Right-click on 'My Computer' and select Properties. Go to Advanced system settings ......
Read more >Throwing error ANDROID_HOME is not set - Appium Discuss
Click the Advanced system settings link. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anybody else who was on information overload - if you have a ~/.bash_profile set up, this is the issue. Quickly add this to your ~/.bash_profile:
export ANDROID_HOME=/usr/local/opt/android-sdk
export JAVA_HOME=/Library/Java/Home
and you should be good to go.
Hi @seppel1992 , It looks like you have not set your ANDROID_HOME environment variable. You can try:
export ANDROID_HOME=<path to your android-sdk>
where<path to your android-sdk>
is the path to installation folder of Android SDK (the folder in which tools, and platform-tools directories are).Please note that this command will only set the ANDROID_HOME for your current shell, consider adding the row to your
.bashrc
file (in case you are using bash)