Nativescript command run - android

I have installed Android-SDK in my ARC Linux system.
but when run command tns run android
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.
Please help.
Thanks.

Add ANDROID_HOME and PATH in .profile file in $HOME directory as :
export ANDROID_HOME="path/to/android-sdk" export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Then try add android as :
tns platform add android
For any doubt refer here : https://github.com/NativeScript/nativescript-cli/issues/1097
This is the original post in NativeScript Github page

Related

While installing IONIC, ANDROID_HOME variable is set but getting 'Failed to find 'ANDROID_HOME' environment variable'

As the title states, I've set up the variable in my .bashrc like so
export ANDROID_HOME=$HOME/Android/Sdk
PATH=$PATH:$HOME/Android/Sdk:$HOME/Android/Sdk/tools
export PATH
and shows fine when I do:
printenv ANDROID_HOME
/home/chris/Android/Sdk
printenv PATH also shows the right paths.
I can cd into that directory and go into the tools directory and run ./android and it works fine (it's there).
However, doing:
ionic build android
(in a separate directory, same shell) I get:
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
I have re-installed IONIC and re-installed the Android SDK as well.. Any ideas?
Ubuntu 16.10 64bit
Thanks.
Ok I figured it out, I was trying to
sudo ionic build android
instead of just
ionic build android
..and sudo has a different set of env variables. Learn something new everyday!
I started to use sudo because I was getting some permission denied errors, but it should've all been cleared, instead of resorting to super user!

Cannot build ionic project due to ANDROID_HOME path issues

I use linux mint. I set the path on ~/.bash_profile like:
export ANDROID_HOME=/home/mss/android-sdks
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
When I build ionic project on android :-
lenovo-g50 ~/IONIC/apps $ cordova run android
Running command:
/home/mss/IONIC/apps/hooks/after_prepare/010_add_platform_class.js /home/mss/IONIC/apps
Add to body class: platform-android
Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
in windows OS
set PATH=%PATH%;C:\Users\userName\AppData\Local\Android\android-sdk\tools;C:\Users\userName\AppData\Local\Android\android-sdk\platform-tools
IN mac
export PATH=${PATH}:/Users/userName/Documents/android-sdk-mac_x86/platform-tools:/Users/userName/Documents/android-sdk-mac_x86/tools
You have to download the sdk. I think your environment variable are set properly, but you don't have the required SDK. type android -v in your console and it start the SDK manager or you can start it manualy in ANDROID_HOME directory. You need to install several build tools and in minimum one SDK Platform.

Could not find aapt with appium server

I am currently trying to run a test on an android emulator device with appium,
everything goes fine, appium unlocks the screen of the device but then I have this error:
[ADB] Error: Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path
I set the ANDROID_HOME varaibale im my bash file to :
export ANDROID_HOME=/home/tar/android/android-sdk-linux/
and I also set the other variables to :
export ANDROID_SDK_HOME=/home/tar/android/android-sdk-linux
export PATH=${PATH}:/home/tar/android/android-sdk-linux/platform-tools
export PATH=${PATH}:/home/tar/android/android-sdk-linux/tools
But I am still facing the same error,
does someone have an idea how to solve this please?
Thank you
First make sure that you've got the SDK installed correctly and that your path in ANDROID_HOME points to the folder containing the /bin folder.
Then try running:
source ~/.bashrc
or log-in and log-out to apply the new changes in the bash file.
You could also reuse your ANDROID_HOME variable:
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools
This way you don't have to change all the variables if the location of the SDK changes.
For Windows:
Open My Computer Properties
Click on 'Advanced System Setting'
Click on 'Environment Variables..'
Create Variable for User and System both
Restart the IDE.!
Please look the image below:
sudo nano ~/bash_profile and add:
export ANDROID_HOME=/home/tar/android/android-sdk-linux/
export ANDROID_SDK_HOME=/home/tar/android/android-sdk-linux
export PATH=${PATH}:/home/tar/android/android-sdk-linux/platform-tools
export PATH=${PATH}:/home/tar/android/android-sdk-linux/tools
In recent versions of Android Studio SDK, aapt is not in tools nor in platform-tools but in build-tools. You need to add it to your PATH for Appium to find it.
export PATH="$ANDROID_HOME/build-tools:$PATH"
Copy aapt.exe from build-tools to platflorm-tools. Also make sure to add ANDRIOD_HOME to sdk folder in Windows Environment variables. This solved my problem.

Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually

I am trying to build an ionic project. I have set up environment for ionic and android in ubuntu. But don't know why the following error is showing on terminal ...
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
I have set up android home as followings ...
userPC:/codes/myApp$ export ANDROID_HOME=/opt/android-sdk-linux
userPC:/codes/myApp$ export ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform_tools
userPC:/codes/myApp$ export ANDROID_TOOLS=/opt/android-sdk-linux/tools
userPC:/codes/myApp$ PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
my android-sdk-linux is in /opt/ itself. From terminal I can run android command. So, I think environment variable is not the main issue. While I am trying to build ionic project, it shows Failed to find 'ANDROID_HOME' environment variable. I am using Android SDK Build Tools 22 and ionic latest version.
Can anyone tell me how can I solve this issue? I have searches a lot but everywhere I found to setup android sdk and environment variable path correctly. But I already have set up all these things. Thanks!
I think you are doing everything right except for the bin part.Add ANDROID_HOME environment variable to path and point out the corresponding bin directory as:
1.export ANDROID_HOME=/path/to/android/SDK
2.export PATH=$PATH:$ANDROID_HOME/bin
when you issue studio.sh command on the command line, it looks for the bin directory in the path which contain executables! studio.sh is the one in this case.
For more information,Read this
Hope this was helpful.
After long time on search. To make a final fix for this problem
Follow Theses incrustation and it will fix it Correctly
Delete your current installation of node & npm & ionic & cordova
Install nvm follow this install nvm ubuntu
Install node with nvm follow this install node via nvm
Install ionic and cordova
npm install -g cordova ionic
Never use root to install node ,npm ,ionic or cordova
Set your Android Home
export ANDROID_HOME=/path/to/android/SDK
export PATH=$PATH:$ANDROID_HOME/bin
After that its worked fine for my and ionic can see Android SDK home

Cordova - ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions

I've installed nodejs and cordova and downloaded android sdk. The thing is when I try and add an android platform here's what sortf happen:
$ sudo cordova platform add android
Creating android project...
/home/blurt/.cordova/lib/npm_cache/cordova-android/3.6.4/package /bin/node_modules/q/q.js:126
throw e;
^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
None of the solutions that I found in the Internet worked.
When I type :
$ echo $ANDROID_HOME
it gives nothing.
When I type:
echo $PATH
it prints
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/games:/opt/android-sdk/tools:/opt/android-sdk/platform- tools:/opt/node/bin:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/node/bin
shows this.
I believe my SDK path is :/opt/android-sdk/tools
You need to set the path to android sdk in ANDROID_HOME. The path needs to be till the root folder of the sdk or /opt/android-sdk/ in your case.
Add the following to your ~/.bashrc file.
# Android Path
PATH=$PATH:$HOME/Documents/Android/sdk:$HOME/Documents/Android/sdk/tools
export PATH
Then do a source ~/.bashrc to reload bashrc
You haven't created the ANDROID_HOME environmental variable for your system. You should add it on the environmental variables by hand for example with method specified by mach on his answer.

Categories

Resources