Eclipse and Android apps development on Fedora Linux

This steps show how to prepare Eclipse on Fedora Core 17 for Android application development. Eclipse with its extensible plug-in system is excellent IDE with all tools (code completion, syntax coloring, error correct suggestion, documentation) needed to create Android application. Fast x86 emulator from Android SDK (that now runs at “near native speed”) gives application development a new level. With all this said, application development has never been more fun …

Contents
  1. Java & Eclipse
  2. Get the Android SDK
  3. Unzip Android SDK to the local disk
  4. Install the Eclipse Plugin
  5. Set Android SDK
  6. Install SDK platform tools

1. Java & Eclipse
Fedora Core 17 comes with Eclipse and Java packages. If your FC17 doesn’t have installed Eclipse then you can install it manually with yum command as root user:

> yum install eclipse-platform

This command will install all dependencies like Java or other modules needed by Eclipse. If you have 64-bit systems, you will need to install some 32-bit packages, because Android SDK is 32-bit. Here is how to install support for 32-bit software on x86_64 system with yum:

> yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686

2. Get the Android SDK
The Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android. Open the following link:

http://developer.android.com/sdk/index.html

and download Linux SDK to the /tmp directory. Downloaded android-sdk_r20.0.3-linux.tgz file has 79MB in size.

3. Unzip Android SDK to the local disk
I didn’t want to unzip Android SDK to my home directory (although it would be the best option regarding file permissions). The package is quite large and I decided to place it to the /usr/local directory:

> cd /usr/local
> tar zxf /tmp/android-sdk_r20.0.3-linux.tgz

After the package is unzipped as a root user, the very next step should be setting directory and file permissions otherwise you will get the following error in the later steps:

Could not find folder 'tools' inside SDK '/usr/local/android-sdk-linux/'.

or

[2012-08-22 08:54:23 - SDK Manager] Error: null
[2012-08-22 08:54:23 - SDK Manager] Failed to create directory /usr/local/android-sdk-linux/temp
[2012-08-22 08:54:24 - SDK Manager] Failed to create directory /usr/local/android-sdk-linux/temp
[2012-08-22 08:54:25 - SDK Manager] Failed to create directory /usr/local/android-sdk-linux/temp

To prevent this errors run the following command as a root user. My user name is “dbunic” and in your case, it should be replaced with your user name:

> chown -R dbunic.dbunic /usr/local/android-sdk-linux

chown will change file owner recursively so with this command I became the owner of Android SDK files in /usr/local directory. Changing owner is not needed if you unzip SDK as “normal” user to your home directory or any other location where you have permission.

4. Install the Eclipse Plugin
Here will be listed main steps to install Eclipse Plugin. Detailed procedure of Eclipse plugin installation can be read at:

http://developer.android.com/sdk/installing/installing-adt.html

4.1) Start Eclipse and select “Install New Software”:

 Help > Install New Software

4.2) Click “Add” in the top-right corner
4.3) In the Add Repository dialog that appears, enter “ADT Plugin” for the name and the following URL for the Location (originally the protocol was https but there was some problems and it worked with http):

http://dl-ssl.google.com/android/eclipse/

4.4) In the Available Software dialog, select the checkbox next to Developer Tools and click “Next”

4.5) Click “Next” several times, choose “Accept the terms of the license agreements” and finally click on “Finish” button (if you get a security warning saying that the authenticity or validity of the software can’t be established just click “OK”)

5. Set Android SDK
After Eclipse was restarted, popup “Welcome to Android Development” will be displayed. Choose “Use existing SDKs” and define location where android-sdk_r20.0.3-linux.tgz was unzipped. In my case I entered the following location:

/usr/local/android-sdk-linux

If file permissions are not set correctly you might get “Could not find folder tools …” error. Correct file permissions of Android SDK and try again. After valid SDK location is entered, click on the “Next” button.

Popup with “Contribute Usage Statiscis” will appear with “Yes” or “No” answers. Whatever you decide, your choice can be changed later in the options panel under:

Android -> Usage Stats

6. Install SDK platform tools
SDK platform tools can be installed right after android-sdk_r20.0.3-linux.tgz package was unzipped. Without Eclipse, Android SDK Manager can be started with the following command:

> /usr/local/android-sdk-linux/tools/android

If this step was omitted, then Eclipse will display the following info:

SDK Platform Tools component is missing!
Please use the SDK Manager to install it.

Just click on the “Open SDK Manager” button on displayed popup:

Choose API level for your applications. Latest API will be probably already checked but if you are beginner or want to develop applications for the great majority of Android phones, then see the current distribution of Android devices that have accessed Google Play within a 14-day period:

http://developer.android.com/about/dashboards/index.html

At this time August 2012, Gingerbread has 60 percent of the total Android market. Although this version has been released for some time, choosing API 10 will not be a mistake. So, select the following items under Android 2.3.3 (API 10):

Android 2.3.3 (API 10)
-> SDK Platform
-> Samples for SDK
-> Intel Atom x86 System Image

Intel Atom x86 System Image is must if you develop on x86 platform. This emulator is much faster than ARM emulator (e.g. YouTube video playback is smooth). OK, click on the “Install 3 packages…” button at the popup bottom and confirm your choice on the next popup (resloved dependencies will be also displayed). If file permissions of Android SDK are not set correctly then platform tool installation will complain with “Failed to create directory …” error. Correct file permissions (see step 2) and reopen “Android SDK Manager” – it’s a small green Android icon in upper toolbar (don’t forget to deselect latest API).

In my case, SDK platform and Samples for SDK were installed but Intel Atom x86 was not. Here is error from Eclipse:

[2012-08-22 09:00:13 - SDK Manager] Error: null
[2012-08-22 09:00:15 - SDK Manager] Stopping ADB server failed (code -1).
[2012-08-22 09:00:46 - SDK Manager] Stopping ADB server failed (code 127).
[2012-08-22 09:00:46 - SDK Manager] Starting ADB server failed (code 127).

I have opened “Android SDK Manager” again and selected only “Intel Atom x86 System Image” under API 10 (I had to deselect latest API because it is selected by default). Don’t know why this error happen but from the second time x86 System Image was installed successfully. Maybe the reason was related to ADB server (it was not running first time).

Anyway, hope this tutorial will help you to prepare Eclipse environment for Android development and believe me, developing Android applications is even more fun. ;)

3 thoughts on “Eclipse and Android apps development on Fedora Linux”

  1. Very clear instructions and easily layed out for anyone to follow. Thanks for sharing.

  2. Fedora publishes new release every 6 months and I wrote this tutorial to have written procedure after new OS installation. Believe me, it’s so easy to forget few steps and then you have to spent several hours for reconstruction how it was last time. So better option is to write down instructions and even better to make it public … :)

Leave a Comment