Googles Android Studio on Linux, installing

Sigh, I’m off on a tangent again.

I really need to test my website against phones. While there are a lot of websites that provide the ability to show how the website appears on different phone models I want a standalone application that I can use without having to be internet connected to test against a test system… so internet based tools are not really an option.

But searches on android emulators generally find dead links to obsoleted projects.

So I’ve decided to try and get the google adroid development kit installed for the emulator.

The getting diverted bit is that it took ages to work out how to setup and install, plus as apps developed using the kit can be installed on phones via a usb connection I will probably play with writing a few apps I want on my phone (my only issue is Java is the primary development language and I stopped using Java over 10yrs ago).

Anyway… the installation documentation does not really cover how to install it, and I had a few issues. This is how I installed and got it running on Fedora22.

The files downloaded were all from the official download site.

  • Selected the “All Android Studio Packages” download link in the assumption that would download all the required packages; that was a tar.gz file android-studio-ide-141.2178183-linux.tar.gz.
    1. mkdir ~/Android as a first step, that is very important
    2. cd to the ~/Android directory and extract the files. It extracts the files into a directory names android-studio
    3. rename android-studio to Studio [optional, but fits better with naming standards imposed]
    4. I then created a bash script in my bin directory that just does a ‘cd’ into the ~/Android/Studio/bin directory and nohups ‘studio.sh’
    5. Ran it. It starts but is incomplete, no SDK Manager option yet
    6. PLus still no emulator command available, “All Android Studio Packages” does not contain all the files needed

At this point I wasted time downloading the SDK download files also; do not do that !. While it does give you the emulator command you get ‘no kernel file’ errors using it with the supllied avd.

What you do instead… is start the Studio again (~/Android/Studio/bin/studio.sh if you followed my naming conventions).

  1. Select the “configure” option
  2. The top entry is the “SDK Manager”, select it
  3. And here you see the importance of the naming conventions I used, the SDK path location is set to ~/Android/Sdk and there does not seem to be any way to change it… using my suggestions you at least get studio and sdk in the same directory tree
  4. It lists the packages required to be installed, the ‘install packages’ button will be highlighted. By default it lists current packages for Android 6.0, you can select older versions if you wish. I selected additional options documentation and samples. When ready click on the ‘install n packages’ button, (read) and accept the license… and wait and wait and wait while lots of stuff is downloaded. But that is how to install the SDK on Linux

Customise your environment, update your ~/.bash_profile to include

PATH=..whateveryouhad...:$HOME/Android/Studio/bin:$HOME/Android/Sdk/tools
export PATH
ANDROID_SDK_ROOT=$HOME/Android/Sdk
export ANDROID_SDK_ROOT

Reload the profile with ‘ . ~/,bash_profile ‘ and you have an almost working environment.

[mark@hawk bin]$ emulator -list-avds
Nexus_5_API_23_x86
[mark@hawk bin]$ emulator -avd Nexus_5_API_23_x86
emulator: ERROR: unknown skin name 'nexus_5'
[mark@hawk bin]$

Interestingly ’emulator -no-skin -avd Nexus_5_API_23_x86′ starts OK… if having no apps other than one that displays the time is what you wanted.

Space requirements including the documentation and samples I downloaded are around 2Gb.

[mark@hawk ~]$ du -ks Android
19316068	Android

My initial, and still active requirement, is to have a emulater to test my website in offline mode against various phones, which this doesn’t meet; so I guess I’m still stuck with using internet websites that provide that function.

But the installation of the Google Android Stidio and SDK has been documented for me to follow at a later date when I try to implement functions I need to andriod applications and may have to rebuild this. It may be usefull to you as well.

update 2015/09/28 : the supplied starter tutorial on the download site for the hello world app crashes in android studio when you get to the passing events step with unable to typecast to (EditText) where the tutorial requires it. It is not a good start when the hello world tutorial on the developer site does not work with the android studio.

About mark

At work, been working on Tandems for around 30yrs (programming + sysadmin), plus AIX and Solaris sysadmin also thrown in during the last 20yrs; also about 5yrs on MVS (mainly operations and automation but also smp/e work). At home I have been using linux for decades. Programming background is commercially in TAL/COBOL/SCOBOL/C(Tandem); 370 assembler(MVS); C, perl and shell scripting in *nix; and Microsoft Macro Assembler(windows).
This entry was posted in Unix. Bookmark the permalink.