0. pre-requisites for Android development on linux
i am using the following platforms and environments. i shall guide you through the setup process of Android ADT Plugin for Eclipse
i have used
-----------------
OS: Linux Ubuntu 9.10 karmic koala
Java: Java 6 JDK
SDK: Android SDK r05 from the site developer.android.com
IDE: Eclipse 3.5 galileo
ADT: AndroidDevelopmentToolkit plugin for developing android apps on eclipse - ADT 0.9.6
1. setup JAVA and Eclipse on your linux machine
for android development, you need to have the JAVA Development Kit installed on your machine.
to setup JAVA on your linux machine for android development-
1. go to terminal
2. command "sudo apt-get install sun-java6-bin";
3. command "sudo apt-get install sun-java6-jdk";
4. follow instructions and your JAVA environment for Android Development will be created
If you are on a x86_64 system, you must also install ia32-libs by the command:
"sudo apt-get install ia32-libs"
Eclipse is the most recommended IDE for android development. all resources and tutorials of Android in developer.android.com refer to the usage of Eclipse IDE. Nonetheless, developers can choose to use a different IDE out of their own comfort.
to setup Eclipse on your linux machine-
1. go to termnial
2. command "sudo apt-get install eclipse"
3. follow instructions and your Eclipse IDE will be created
2. setup Android SDK
setting up the Android SDK for linux
------------------------------------------------------------------
1. go to http://developer.android.com/sdk/index.html and download the linux distribution of the Android Development SDK
2. copy the downloaded distribution file (*.tgz file most possibly) into your home folder.
~~~~Suppose the linux distribution of ADT is called linuxADT.tgz. Copy the tar file to your home directory location: /home/myUserName/linuxADT.tgz
~~~~it's recommended to put the .tgz file in the home folder of your system to avoid complex permission and rights related issues.
3. open TERMINAL and cd to the location where you have copied the .tgz file
~~~~use the command: cd /home/myUserName/
4. then execute the command: tar -xzvf linuxADT.tgz
~~~~the xzvf parameters are important for granting user rights and permissions to the untarred folder.
5. you shall see that a new folder called 'android-sdk-linux_86' has been created in the folder /home/myUserName/ with all the permissions and rights issues taken care of. this is the folder inside which all the android specific files and updates are kept.
6. after this you have one last thing remaining to do. adding the tools directory in this folder to the classpath of linux bash.
~~~~this is an optional step. but if you do this step, you will be relieved from typing the entire location of the android SDK tools. you can simply command 'android' and linux will automatically find out through the classpath where the android file is located and will execute it like a native command. this is how you do this step.
~~~~a. open terminal
~~~~b. command: sudo gedit ~/.bashrc
~~~~c. add the following line to the end of the file without the quotation marks
"export PATH=${PATH}:/home/myUserName/android-sdk-linux_86/tools"
7. You are done setting up the Android SDK for linux. to see if the SDK runs properly, open up the terminal and command 'android'.
~~~~if you had chosen to skip the step no 6 of adding the tools directory to the classpath, then just writing android won't work. you have to cd to the location of the TOOLS directory in the android folder and then command 'android'
Android SDK setup for Linux is complete
:) :) :)
3a. setup ADT plugin for eclipse
next you have to setup the ADT (Android Development Toolkit) plugin for eclipse to develop android Apps on Eclipse
[disclaimer: this tutorial is for those developers who wish to use Eclipse as their IDE for android Apps development. users preferring any other IDE may not find this part of the article relevant]
to setup ADT for Eclipse, you need to add the ADT installation web resource into eclipse.
to do this-
1. open Eclipse 3.5 Galileo IDE
2. goto Help > Install New Software
3. click on the add button
4. write the Name as "ADT Plugin" or anything you may prefer
5. write the location as "https://dl-ssl.google.com/android/eclipse/"
if you face any connectivity problem with https site, replace the 'https' with 'http'.
if you face no such problem, it's suggested to use https due to security purposes
6. then click OK
7. after clicking OK, give some time for the software descriptions to be downloaded from the software resource location you just added
8. when the descriptions are loaded, make sure to Check 'Developer Tools' and click next
7. follow the install instructions pages to proceed with the installation.
8. your ADT for eclipse is now setup.
-------- official reference: http://developer.android.com/sdk/eclipse-adt.html.
[caution: installing ADT for Eclipse on Linux can face some dependency issues and, hence, your ADT installation might be interrupted. This is usually not the case when installing ADT for Eclipse on Windows. To find out how to resolve these dependency issues IF YOU FACE ANY, move through the following steps of this tutorial.]
3b. resolving dependency issues while installing ADT
PROCEED WITH THE REST OF THE TUTORIAL/GUIDE ONLY AFTER YOU HAVE DONE THE STEPS MENTIONED IN THE PREVIOUS PARTS
possible problems you might face while installing ADT for Eclipse.
dependency issues with gef library......
dependency issues with wst library......
other dependency issues.....
etc.
to resolve dependency issues of any kind (if you face any dependency issue while installing the ADT for Eclipse) add the following Software Resource Locations one at a time via Eclipse > Help > Install New Software > Add and then installing each Software Resource immediately after adding
1. gef error - http://download.eclipse.org/tools/gef/updates/releases/
2. wst error - http://download.eclipse.org/releases/galileo
If dependencies are still not resolved for ADT installation, try adding the following Software Resource Locations to Eclipse and install them one by one. After installing each one, see if the ADT can now be installed. if ADT installation says dependency problem, then add the next resource, install it and again see if ADT can be installed
3. others - http://dl.google.com/eclipse/plugin/3.5
- http://download.eclipse.org/eclipse/updates/3.5
- http://download.eclipse.org/technology/epp/packages/galileo
- http://download.eclipse.org/datatools/updates
- http://download.eclipse.org/webtools/updates/
- http://download.eclipse.org/modeling/emf/updates/releases/
This often gets frustrating at times to loop through the installations again and again and check repeatedbly whether ADT is able to install or not.... but with the robust, quick and easy way of Androdoid Application Development, these roundabouts are worth it.
*********************************************
by now, you should be done with installing the ADT for Eclipse on Linux :) :) :)
4. linking AndroidSDK preferences to Eclipse
by now you have completed the setup of
~ JAVA 6 JDK and BIN
~ Android SDK
~ Eclipse 3.5 Galileo
~ ADT 0.9.6 or later
now comes the part of connecting Eclipse with the SDK
1. Restart Eclipse
2. Window > Preference
3. Browse to the location where you install the Android SDK.
for this tutorial, we used the location /home/myUserName/android-sdk-linux_86/
remember that it's recommened to keep the android-sdk-linux_86 folder in your linux home directory to avoid permission and rights denial problems
4. Click Apply, and wait for a moment. The list of SDK will be populated.
5. Click OK.
Your Eclipse+Android development IDE setup is now finished.
You are now start working with android :) :) :)
5. installing AndroidOS versions and platforms
you need to install
~ Android SDK tools
~ Documentations
~ Android Platforms
~ Samples and APIs
before you can see your Android Experience in action.
you can do that using the SDK and AVD manager that you have just linked up with Eclipse IDE in the previous step.
to do that:
1. restart Eclipse
2. go to Window > Android SDK and AVD manager
3. click on the tab 'Available Packages'
4. if there is no site listed down, click on the 'Add Site' button
5. add "https://dl-ssl.google.com/android/repository/repository.xml"
You should now see a site link being shown in the list
6. expand (or drop-down the site link)
7. you must install at least one Android Platform
to see what are things you already have installed, go to the tab 'Installed Packages' in SDK and AVD Manager,
it's adviced to have several API versions and Platform Versions to be installed so that you can test your application for different kinds of OS versions
You are done with Installing Android OS platforms :) :) :)
6. creating a AVD - and seeing Android in Action
ayou need to create a AVD first (Android Virtual Device) to run or debug or just to explore the user experience of AndroidOS.
the AVD is a demo mobile phone which has a demo AndroidOS running on it.
And you can do that using the SDK that you have just linked up with Eclipse IDE in the previous step.
1. restart Eclipse IDE
2. go to Help > Android SDK and AVD manager
3. go to the tab 'Virtual Devices'
You might see that the list is empty
4. Click on New to add a new Android Virtual Device (also called AVD)
5. Set the names and options as you need. Name it myFirstAVD.
6. For your first AVD, it's advised to populate the Hardware list with all the hardwares available from the NEW button.
7. Once you are done setting up your device, click 'Create AVD'.
you should now see a new item named myFirstAVD in the Virtual Devices tab list. this is your Android Virtual Device.
to see the AndroidOS function, select the item myFirstAVD and click Start.
you should now see a new window with mobile interface buttons and keypads, with a black screen written 'Android_' and a blinking a cursor.
it takes some time for the OS to boot up......
hold your patience......
let the Android homescreen come online......
Enjoy exploring the capabilities of AndroidOS on your first AVD......
:) :) :) :)
7. your first Android project
to develop your first android project of "Hello World"
goto http://developer.android.com/resources/tutorials/hello-world.html for a described step-by-step instructions.
follow the steps of Java coding according the tutorial.
TADAAAA :) :) :) :) :)
hope you enjoy developing for the open source platform of Android
8. citation of the writeup
Thanks to the following sources of forums and write-ups with which this article of "Android Development on Linux was created"
------------------
http://developer.android.com/resources/tutorials/hello-world.html
http://developer.android.com/sdk/installing.html
http://developer.android.com/sdk/eclipse-adt.html
http://android-er.blogspot.com/2009/07/install-android-sdk-on-eclipse-35.html
http://www.webmasterworld.com/forum23/1805.htm
http://androidcommunity.com/forums/f4/missing-org-eclipse-wst-sse-core-0-0-0-while-installing-sdk-for-eclipse-3-5-a-28714/
http://tewson.com/content/orgeclipsegef-000-required-installing-android-development-tools-eclipse-351
http://www.talkandroid.com/android-sdk-install-guide/
http://www.helloandroid.com/tutorials/how-set-eclipse-android-sdk-ubuntu-linux-904910-updated
Great post, helped me a lot. Thanks!!
ReplyDeleteThis is one of the wonderful post.I like your blog achievement.This is one of the good post.
ReplyDeleteAndroid app developers
Fantastic
ReplyDeletehi for some reason i cant add the android-sdk-linux_x86 folder in step 4. i cant select the android-sdk-linux_x86 folder. ive done this in windows already but in ubuntu it doesnt select the folder and the Send statistics to Google dialog doesnt seem to be responding. any help? thanks.
ReplyDeleteumm......... i am not able to understand why this should happen
ReplyDeleteFinally got it set up. Thanks so much!
ReplyDelete