I downloaded the Android SDK tools from https://developer.android.com/studio/index.html which gave me a zip file called tools_r25.2.3-linux.zip
. Unziped, it produced a folder called tools
, containing the sdkmanager, android
. When I tried to run it, it failed with the error message above.
I set ANDROID_HOME
to the tools
directory, but it still failed.
It turns out that ANDROID_HOME
needs to be set to the parent directory, with the contents of the zip file (a single directory named tools
) contained within it. Once I did that, it worked fine. This seemed confusing enough to be worth adding to stackoverflow.
The zip file can be opened anywhere. The important thing is to leave the name "tools" and it's files intact.
Run the android program from the tools parent directory as:
$ ./tools/android
This will update the tools parent directory (the one from where you are running ./tools/android
) with a number of folders and tools.
I name this parent directory sdk. I also place the whole directory (named sdk
) in a folder by the name of the downloaded version.
Now for consistency of my programming environment I bind mount this sdk to a folder in the /opt
directory so that it'll be available system-wide.
The hierarchy becomes:
/home/userid/android_r25.2.3/sdk
Now I make a folder in the /opt/
directory called /opt/android/sdk
.
My /etc/fstab
entry for this becomes:
/home/userid/android_r25.2.3/sdk /opt/android/sdk none bind
It's mounted with:
$ sudo mount /opt/android/sdk
The only thing that changes with new versions or new installs is the location of where the zip file is opened. replace the /home/userid/android_r25.2.3/sdk with where you extract the zipfile and nothing else would ever have to be changed.
The PATH variable will consistently become:
$ export PATH=$PATH:/opt/android/sdk/tools:/opt/android/sdk/platform-tools
And, of course, the eclipse android configuration becomes:
/opt/android/sdk
Using this as a consistent procedure makes reinstalls and installs on new machines very seamless... having only one variable that might change, and that is where the package is extracted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With