Monday, June 20, 2011

Android development in Linux/Windows

I am currently working on developing an Android app and thought of sharing the basics of Android app development. I develop in Linux. It should be the same in Windows.

First, you need the Eclipse IDE. You actually can develop for Android without it but it's a lot easier with Eclipse. Installation of the eclipse IDE in Linux (In Windows, it isn't a problem) from the eclipse site might lead to complications later on with regard to location of Java and running from the terminal etc. So, I suggest you install it from the synaptic package manager. To install the Eclipse IDE and get it working, you will need Java installed in your computer. Installation of Java in Windows is a piece of cake with ready made exe files and other Windows crap. Java installation in Linux can get a little hard if you are new to it. You can read another post of mine which explains it in detail. Now, assuming you have got Java and eclipse installed in your computer, let's move further.

Download the Android SDK for Android development from their official site.

Tip#1 for Windows: Download the recommended installer and run it. This installer checks if Java is installed in your computer. A bug here is even if you have, they don't let you proceed saying that JDK is not installed. This wasted a lot of my time but I found a way around this by clicking Back and then Next again. All of a sudden, they are able to detect JDK (windows is lame, it's high time you get that, folks).

After extracting the Android SDK directory in a location of your choice, follow the instructions on the site. It also includes the installation of the ADT plugin of Eclipse.

Tip#2 for Windows: While setting the preferences for the ADT plugin in Eclipse, you won't be able to give the android sdk location because they will give an error saying adb.exe is not present. All you have to is got the Android SDK directory and run the SDK manager and install platform-tools. This directory once installed will contain the adb.exe file and you can now set the preferences of the ADT plugin.

Tip#3 for Windows: When you try installing any of the packages that need to be installed like platform documentation etc., you might get an error saying unzip failed, nothing installed. This happens because you don't have Administrator privileges (if you have extracted eclipse in C:\) You can prevent this from happening by running eclipse by right clicking eclipse.exe and Run As Administrator. But, you might have to do this whenever you want to install anything. So, I suggest moving the eclipse folder to the D or some other drive.

Now, you would have downloaded atleast one platform to run your android apps. I had installed the API Level 12 platform which kept crashing. I suggest installing the API Level 8 platform. Safe and woks well (Look at the timestamp of this post. If you are reading this a long time later, then API Level 12 must be working properly now).

I hope you have now got Eclipse with ADT working now. Any doubts, please post them as comments and I'll be happy to answer them. Go ahead and write your Hello World! application. Happy coding :)

P.S: Wait for my next post which will incllude sample codes and tips ;)

3 comments:

  1. Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.




    Android App Development

    ReplyDelete
  2. Guys need windows key that i suggest you go site www.vanskeys.com to got. 100% genuine it to provide. Hope it can help you.

    ReplyDelete