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.
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:
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:
After trying to find “Android Project” for at least half an hour, I have discovered that other people have the same issue:
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:
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.
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:
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:
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!