Reputation: 1748
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.
Upvotes: 13
Views: 5595
Reputation: 3198
unzip tools into e.g. ~/android-sdk
, so it will live at ~/android-sdk/tools
then in ~/.bashrc
export ANDROID_HOME="$HOME/android-sdk"
ANDROID_TOOLS="$ANDROID_HOME/tools"
ANDROID_PLATFORM_TOOLS="$ANDROID_HOME/platform-tools"
export PATH=${PATH}:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS;
then run sdkmanager
Upvotes: 0
Reputation: 1719
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.
Upvotes: 4
Reputation: 1748
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.
Upvotes: 17
Reputation: 8728
One more issue is that one has to leave the name of the unzip
result tools
untouched and move it into a to be created directory in order to allow any version management (or leave it in your home directory if a information-free directory name like "tools" doesn't distrub you). Then set ANDROID_HOME
like @JesseW explained.
Upvotes: 3