_From @wisonye on February 25, 2016 2:48_
> [email protected] postinstall /usr/local/lib/node_modules/nativescript
> node postinstall.js
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.
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
TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.
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
TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.
Verifying CocoaPods. This may take more than a minute, please be patient.
npm ERR! registry error parsing json
WARNING: There was a problem with CocoaPods
Verify that CocoaPods are configured properly.
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 the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=22 <=23'.
Run android 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 $ android to manage the Android Support Repository. In case you already have it installed, make sure ANDROID_HOME environment variable is set correctly.
and what problem is this ???
Verifying CocoaPods. This may take more than a minute, please be patient.
npm ERR! registry error parsing json
WARNING: There was a problem with CocoaPods
_Copied from original issue: NativeScript/NativeScript#1640_
Hi @wisonye,
Are you sure that the result of echo $ANDROID_HOME is an existing folder pointing to the root of Android SDK and can be accessed by the user you are currently in, and the user has permission to execute shell files from that folder.
EDIT: also try this: https://github.com/NativeScript/nativescript-cli/issues/1425
@Plamen5kov Sure, of course, here is the command and output :)
Wisons-MacBook-Pro:NativeScriptProject wison$ echo $ANDROID_HOME
/Users/wison/android-sdk-macosx
Wisons-MacBook-Pro:NativeScriptProject wison$ ll /Users/wison/android-sdk-macosx
total 8
-rw-rw-r--@ 1 wison staff 1.1K 13 Oct 18:58 SDK Readme.txt
drwxrwxr-x@ 2 wison staff 68B 13 Oct 18:58 add-ons
drwxr-xr-x 4 wison staff 136B 27 Dec 21:02 build-tools
drwxr-xr-x 5 wison staff 170B 27 Dec 21:03 extras
drwxr-xr-x 13 wison staff 442B 22 Dec 22:13 platform-tools
drwxrwxr-x@ 5 wison staff 170B 27 Dec 21:09 platforms
drwxr-xr-x 5 wison staff 170B 27 Dec 21:59 system-images
drwxr-xr-x 2 wison staff 68B 27 Dec 21:59 temp
drwxr-xr-x 31 wison staff 1.0K 22 Dec 22:18 tools
@Plamen5kov And actually I also try use "sudo" to call the "android", and it's fine, I remember the "--log trace" seems use this command, then I think your install script should use it as well ( to confirm your install script can run the "android", right ? )
Wisons-MacBook-Pro:NativeScriptProject wison$ sudo /Users/wison/android-sdk-macosx/tools/android -h
Usage:
android [global options] action [action options]
Global options:
-s --silent : Silent mode, shows errors only.
-v --verbose : Verbose mode, shows errors, warnings and all messages.
--clear-cache: Clear the SDK Manager repository manifest cache.
-h --help : Help on a specific command.
Ok @wisonye, everything looks great so my next question would be can you execute the adb command. The adb should be in /Users/wison/android-sdk-macosx/platform-tools/adb.
Did you try: https://github.com/NativeScript/nativescript-cli/issues/1425 ?
@Plamen5kov Sure, no problem, run it, result:
Wisons-MacBook-Pro:NativeScriptProject wison$ /Users/wison/android-sdk-macosx/platform-tools/adb
Android Debug Bridge version 1.0.32
Revision 09a0d98bebce-android
-a - directs adb to listen on all interfaces for a connection
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <specific device> - directs command to the device or emulator with the given
serial number or qualifier. Overrides ANDROID_SERIAL
........( ignore, too long, result is the help )
@Plamen5kov If you're saying I SHOULD use "sudo npm i -g nativescript --unsafe-perm" to install NativeScript, then I didn't try, I try later and then let you know the result, thanks for your good job :) NativeScript is the BEST( not just better )
@Plamen5kov I've tried that, but it still report that warning, here is the output when I install NativeScript via "sudo npm i -g nativescript --unsafe-perm" :
> [email protected] install /usr/local/lib/node_modules/nativescript/node_modules/fibers
> node build.js || nodejs build.js
`darwin-x64-v8-4.5` exists; testing
Binary is fine; exiting
> [email protected] install /usr/local/lib/node_modules/nativescript/node_modules/utf-8-validate
> node ./build.js
`darwin-x64-v8-4.5` exists; testing
Binary is fine; exiting
> [email protected] install /usr/local/lib/node_modules/nativescript/node_modules/ref
> node ./build.js
`darwin-x64-v8-4.5` exists; testing
Binary is fine; exiting
> [email protected] install /usr/local/lib/node_modules/nativescript/node_modules/bufferutil
> node ./build.js
`darwin-x64-v8-4.5` exists; testing
Binary is fine; exiting
> [email protected] install /usr/local/lib/node_modules/nativescript/node_modules/ffi
> node ./build.js
`darwin-x64-v8-4.5` exists; testing
Binary is fine; exiting
> [email protected] install /usr/local/lib/node_modules/nativescript/node_modules/node-inspector/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
/usr/local/bin/nativescript -> /usr/local/lib/node_modules/nativescript/bin/nativescript.js
/usr/local/bin/tns -> /usr/local/lib/node_modules/nativescript/bin/nativescript.js
> [email protected] postinstall /usr/local/lib/node_modules/nativescript
> node postinstall.js
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.
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
TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.
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
TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.
WARNING: CocoaPods is not installed or is not configured properly.
You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.
To be able to build such projects, verify that you have installed CocoaPods.
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 the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=22 <=23'.
Run android 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 $ android to manage the Android Support Repository. In case you already have it installed, make sure ANDROID_HOME environment variable is set correctly.
[email protected] /usr/local/lib/node_modules/nativescript
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected])
^C
Wisons-MacBook-Pro:temp wison$ vi ./install.log
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected])
Hi @wisonye,
Can you try this. Start node (on the console type node). When you are in the node REPL, type
process.env.ANDROID_HOME
This should print the value of ANDROID_HOME as seen by NativeScipt CLI as opposed as seen by your shell. Sometimes they can differ in more complex scenarios. Check if the value printed is correct.
You mentioned another problem - with CocoaPods. Currently I do not have access to a mac to check, but on top of my head, can you type in Terminal
pod --version
It should say something similar to 0.39.
@teobugslayer Here is my print out which you ask for:
Wisons-MacBook-Pro:NativeScriptProject wison$ echo $ANDROID_HOME
/Users/wison/android-sdk-macosx
Wisons-MacBook-Pro:NativeScriptProject wison$ node
> process.env.ANDROID_HOME
'/Users/wison/android-sdk-macosx'
>
And here is pod version:
Wisons-MacBook-Pro:NativeScriptProject wison$ pod --version
0.39.0
Hi @wisonye ,
May I ask you for your version of MacOS. It looks like Yosemite has some issues with Environment variables. Maybe that's the case on your side?
@rosen-vladimirov My Yosemite version is "10.10.5", and all my environment setup in my "~/.bash_profile" :) And actually all my android stuff run fine, didn't say anything "ANDROID_HOME didn't set issue", then I think should not be the env var on my own side( I guess ) :)
Hey @wisonye,
Do you still have problem with this using our latest version?
Hi @fornsss the ANDROID_HOME environment variable should point to the root folder of the android SDK.
@wisonye @enchev I have this problem, too. How did you solve it? I use Linux.
Guys,
here is my fix on Ubuntu 16.04.3 LTS.
step 1. Add the below to the .bash_profile(create if you don't have it):
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
export ANDROID_HOME=/home/(your user)/Android/Sdk
export PATH=${PATH}:/home/(your user)/Android/Sdk/platform-tools:/home/(your user)/Android/Sdk/tools:/home/(your user)/Android/Sdk/tools/bin
at the end ==> $ source ~/.bash_profile
step 2. Install the latest version of build-tools in my case it's v.27
sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-27" "build-tools;27.0.1" "extras;android;m2repository" "extras;google;m2repository"
step3. In android studio open SDK manager and install all packages in SDK Tools (except google play)
After all aforementioned I got this:
`user@user:~$ tns doctor
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.
Your components are up-to-date:
nativescript,tns-core-modules,tns-android,tns-ios
No issues were detected.`
@fuser84 Excellent, thanks! your step 1 in ~/.bashsrc did it for me on Linux Mint 17.3
Most helpful comment
Guys,
here is my fix on Ubuntu 16.04.3 LTS.
step 1. Add the below to the .bash_profile(create if you don't have it):
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/export ANDROID_HOME=/home/(your user)/Android/Sdkexport PATH=${PATH}:/home/(your user)/Android/Sdk/platform-tools:/home/(your user)/Android/Sdk/tools:/home/(your user)/Android/Sdk/tools/binat the end ==> $
source ~/.bash_profilestep 2. Install the latest version of build-tools in my case it's v.27
sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-27" "build-tools;27.0.1" "extras;android;m2repository" "extras;google;m2repository"step3. In android studio open SDK manager and install all packages in SDK Tools (except google play)
After all aforementioned I got this:
`user@user:~$ tns doctor
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.
Your components are up-to-date:
nativescript,tns-core-modules,tns-android,tns-ios
No issues were detected.`