1

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

Tar
  • 185
  • 1
  • 1
  • 16

5 Answers5

3

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.

Daniel Wild
  • 167
  • 3
  • 7
1

For Windows:

  1. Open My Computer Properties
  2. Click on 'Advanced System Setting'
  3. Click on 'Environment Variables..'
  4. Create Variable for User and System both
  5. Restart the IDE.!

Please look the image below:

enter image description here

Pratik Patel
  • 2,209
  • 3
  • 23
  • 30
0

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

rollingthedice
  • 1,095
  • 8
  • 17
0

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"
David Ferrand
  • 5,357
  • 1
  • 33
  • 43
0

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.

Vishnu
  • 1