0

I have followed all steps mentioned from here

I have set ANDROID_HOME and set PATH in bashrc file.

 export ANDROID_HOME=/home/sanjay/Android/Sdk
 export PATH=$PATH:/home/sanjay/Android/Sdk/tools
 export PATH=$PATH:/home/sanjay/Android/Sdk/platform-tools

But still the error "environment variable is not set", "It should be set to SDK home directory" pops up every time I try to build an app.

Please help to resolve this issue..

Community
  • 1
  • 1
  • Can you please add the more details means your bash file ? – Santosh Shinde Jan 27 '17 at 06:46
  • you need to either logout-login or run `source .bashrc` for the updated file to take effect – Suraj Rao Jan 27 '17 at 06:51
  • I added the details. Do I need to provide more? –  Jan 27 '17 at 06:51
  • I did logout-login. Also did a reboot once. But still no effect. When I echo $ANDROID_HOME or $PATH, the changes are reflected –  Jan 27 '17 at 06:52
  • Are you create the hybrid mobile app or native android app ? – Santosh Shinde Jan 27 '17 at 06:53
  • and please try to run android command on terminal – Santosh Shinde Jan 27 '17 at 06:55
  • I am building a native android app –  Jan 27 '17 at 06:55
  • If you mean to run adb command on terminal, it works. –  Jan 27 '17 at 06:57
  • are you using android studio? – Suraj Rao Jan 27 '17 at 07:04
  • Are you starting your IDE as root? – Simas Jan 27 '17 at 07:04
  • Yes, I am using Android studio. And I did not start IDE as root. I created a desktop entry for Android studio from Android studio->Tools. I start the IDE from desktop itself –  Jan 27 '17 at 07:06
  • is the SDK path set in android studio sdk manager? – Suraj Rao Jan 27 '17 at 07:08
  • Yes. The SDK path is set correctly in SDK manager –  Jan 27 '17 at 07:15
  • Assuming you are building the project using gradle. You should post the gradle output near the error message, as to specify what build step or tool causes the error. – S.D. Jan 27 '17 at 09:24
  • The error I get is: :IME:installPlatformSDK Error : [installPlatformSDK] environment variable ANDROID_HOME is not set. It should be set to SDK home directory FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':IME:installPlatformSDK'. > Error : [installPlatformSDK] environment variable ANDROID_HOME is not set. It should be set to SDK home directory –  Jan 27 '17 at 09:47

2 Answers2

1

Remove the spaces betwen the path and ANDROID_HOME in this line:

export ANDROID_HOME = /home/sanjay/Android/Sdk

such that it reads:

export ANDROID_HOME=/home/sanjay/Android/Sdk
chandsie
  • 2,865
  • 3
  • 27
  • 37
0

It is not that difficult but you got to make your project make know weatabouts of your SDK.

Try following in your terminal

temporary option: In terminal root of your project

export ANDROID_HOME=[sdk location]

gradle build

===================================

adding path permanent: Linux - ~/.bashrrc

export ANDROID_HOME=[sdd location]

export PATH=$ANDROID_HOME:$PATH

siva
  • 328
  • 5
  • 7