How to setup ADT (Android Development Tools) on 64bit Fedora 17 ?

Quick Intro

Yesterday I was excited to receive a task to install ADT for Eclipse and Android SDK on my machine , I thought it would be a “piece of cake”, so with a high level of excitement I have started….

As I use  my laptop with Fedora 17 (64bit) for all my developments, I have decided that I will put my Android Development Tools in it as well.

Installation…

As my first step I went to the http://developer.android.com/sdk/index.html and thankfully there is ADT bundle for Linux 64-bit, which consists of custom version of Eclipse Juno, equipped with everything one needs for Android development and  Android SDK that includes such tools as Android debugger and Emulator.

After downloading Android SDK I have run Eclipse, and surprisingly, instead of default Eclipse intro, ADT-equipped Eclipse has fancy intro:

adt-intro

ISSUE 1: Android Project Replaced with Android Application Project

After Eclipse has fully loaded, I have decided to create an Android Project. My instructions said that I need to go to File -> New – >”Android Project”. Unfortunately, the version that I have installed does not have option “Android Project”. Closest option to “Android Project” was “Android Application Project”. Here is the screenshot:

Android Development_tools_create_project

After trying to find “Android Project” for at least half an hour, I have discovered that other people have the same issue:

http://stackoverflow.com/questions/11329753/no-android-project-option-in-eclipse
http://stackoverflow.com/questions/11604641/difference-between-android-application-project-and-android-project

Solution:

So my decision was to use “Android Applciation Project”, I have just unchecked option to select launch icon.

I have set Project name, Package name and Activity. Everything seemed to be fine and my project was populated with whole bunch of android related files.

ISSUE 2: R Cannot be resolved to a variable   and adb cannot be found

After project files were generated I have faced my next problem. In my src file I had 2 errors regarding “R” which cannot be resolved. After doing a research again I have found out that even more people have the same issue:

http://stackoverflow.com/questions/7906606/after-installing-android-adt-14-r-cannot-be-resolved
http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error
http://stackoverflow.com/questions/8266100/r-cannot-be-resolved-in-eclipse-android-project
http://stackoverflow.com/questions/7824730/r-cannot-be-resolved-to-a-variable
…………

Most of the advices were to clean and rebuild the project which did not gave me any results. One of the advice was to install ia32-lib, however this library is available for other “distros”, but not Fedora.
After 2 hours of trying different stuff, which did not work, I have found out the cause of the problem.

Reason of the error:

The reason why R cannot be resolved is because R should point to the R.java file, which is auto generated and is located in the gen folder. In our case R.java was not generated, thus Eclipse was not able to resolve it.

Together with “R cannot be resolved” error, Eclipse Error Log gave me one more error which looked like this:

Unexpected exception 'Cannot run program 
"/home/aspektor/adt-bundle-linux-64/sdk/platform-tools/adb": error=2 
No such file or directory' while attempting to get adb version from

It looked to me that these problems are connected.

Solution:

After couple of hours of trying tons of different things, I have realized that the reason of the problem is that Android SDK is initially intended for 32 bits. As I have 64bit Linux I need to install additional 32bit packages to make it work.

Thankfully I have found wonderful guide, that helped me in solving most of my issues:

http://fedoraproject.org/wiki/HOWTO_Setup_Android_Development

I have run this command to install 32bit packages:

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

I have also set up PATH in ~/.bash_profile so adb and other tools can be found:

export ANDROID_SDK_HOME=/home/aspektor/adt-bundle-linux-64/sdk
PATH=$PATH:$HOME/adt-bundle-linux-64/sdk:$HOME/adt-bundle-linux-64/tools
export PATH
# For SDK version r_08 and higher, also add this for adb:
PATH=$PATH:$HOME/adt-bundle-linux64/sdk/platform-tools
export PATH

Finally, I have restarted Eclipse, cleaned and rebuild my project and 5 hours later….. tired but satisfied I have created ADV (emulator) and run my ADT project.

Thankfully it worked:

eclipse-works

After-thoughts…

I think it would be reasonable for Android website to ADVICE (put it in bold and somewhere where everyone could see? ) people who have 64-bit Linux need additional 32 bit libraries. It would save folks like me a lot of time. Not saying that these packages should be per-requisite before downloading bundle 🙂

If you have any other comments, go ahead, I would love to hear them!

Regards,

Anatoly

Thanks for installing the Bottom of every post plugin by Corey Salzano. Contact me if you need custom WordPress plugins or website design.

Anatoly Spektor

IT Consultant with 6 years experience in Software Development and IT Leadership. Participated in such projects as Eclipse IDE, Big Blue Button, Toronto 2015 Panam Games.

Join the Discussion

Your email address will not be published. Required fields are marked *

Discussion

  1. Atomic Reach (@Atomic_Reach)

    Hi Anatoly,

    I think it’s really great what you are doing with your programming blog, and you’ve got great insights in your field. I especially like your use of images in this post and step-by-step instructions on how to set up an ADT. As an expert in topics such as software dev and resources for the API community, I’m are reaching out to you to participate in an API community we’re building.

    If you decide to join, we will publish the title of your posts and the first few sentences of each post on an API website. If readers want to read the full story, they’ll be pushed to your blog. The benefits are straightforward: increased exposure and more traffic to your site.

    If you’re interested or have any questions, please send me an email with “API” in the subject line and I’ll send you a link to activate your account (or an answer questions).

    I look forward to you joining our community!

    Kindest regards,
    Tina Jin

    1. Anatoly Spektor

      Hey Tina,

      Thank you for contacting me, I am glad that you like my blog!

      Regarding your offer, could you please post your email address so I can follow up with you!

      Thanks,

      Anatoly

  2. Jonathan

    Many thanks for documenting this and making it easier to find by googling!

  3. Bilal

    thank you buddy. Superb! explanation

arrow