ANDROID_HOME is not set? - android

I am currently setting up an Appium platform and it's having trouble finding my ANDROID_HOME path. I have the sdk downloaded and installed in Users/User/Android/sdk. My bash_profile looks like this:
export PATH=$PATH:/usr/local/bin
export JAVA_HOME=$/usr/libexex/java_home
export ANDROID_HOME=Users/User/Library/Android/sdk
PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
echo $ANDROID_HOME
When I run Appium Doctor, I get the following error message:
✖ ANDROID_HOME is set but does not exist on the file system at "Users/Toast/Library/Android/sdk"
That is the path to the SDK as defined in Android Studio. What am I doing wrong?

It seems you are missing a / in the beginning of the absolute path for ANDROID_HOME. It should probably start with /Users... Something like:
export ANDROID_HOME=/Users/User/Library/Android/sdk

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.

Why ANDROID_HOME path is required Android Linux?

I have one confusion about Android environment variable path.
As we already are setting tools and platform-tools path for Android SDK.
So, Why do we require to set ANDROID_HOME path as environment variable ?
Is it replaced by tools and platform-tools path?
thanks,
Some scripts and build tools require access to SDK main path (for example to get platforms folder) and they cant get this path from path environment variable.
ANDROID_HOME is usually a directory like .android. Its where things like the Debug Key will be stored.
export ANDROID_HOME=~/.android
You can automate it for your login. Just add it to your .bash_profile (below is from my OS X 10.8.5 machine)
$ cat ~/.bash_profile
Android
export ANDROID_NDK_ROOT=/opt/android-ndk-r9
export ANDROID_SDK_ROOT=/opt/android-sdk
export JAVA_HOME=`/usr/libexec/java_home`
export ANDROID_HOME=~/.android

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