2013-06-16

Setting up Android SDK in Eclipse

In this article we are going to see how to set up android SDK with eclipse.We are doing this for mainly two purposes.
1. When we try Robotium to for android unit testing, we need that
2. When we do code review or android junit unit test case writing
Beside that, for development we need to set up android sdk.

Step 1 : Download Eclipse 
We need to download Eclipse from this link.  I use eclipse classic, yo may use j2ee or java developer edition.

Step 2 : Download Java
We need to have JAVA(sdk) in the PC. I use x86 SDK, you may also try x64 SE editions. Download link. To check if java installed in you pc or not, you may check C:\Program Files\Java or C:\Program Files (x86)\Java folder having java SDK(for windows).
From command prompt if we use following command , we can also know , does the PC have Java or not.
java -version

Step 3 : Download Android SDK 
WE need to download android SDK from this link. 
For windows
For MAC
For Linux

Step 4 : Install SDK 
Install the SDK that we have just downloaded. 

Step 5 : Add to OS path (as system variable)
We need to add sdk path as environment variable. To add this in windows 7/8
Right click My computer > properties >advance system settings , then click Environment variable . Select Path > click Edit then add the path at the end with semi colon(;) . Now , press ok.
 
To check, it is working or not, open command prompt and write
adb devices
(please connect an android device to see the device ID). If you see, no command found, that means not done. If command is found , it will show device ID or blank (if no device)

Step 6 : Install Eclipse Android Plugins : We need to install android plugins in eclipse.
-To do that, open eclipse
-Click Help from Menu
-Click Install New Software
-Click Add button
-In name (name of the plug in), write ADT plugins
-In Location, write : https://dl-ssl.google.com/android/eclipse/
-Press ok, you will see the list after loading from Internet. Select developer tools and press next, next up to finishing process to install(with agree the agreements). Wait for the plugins to be downloaded. Then close eclipse and run again(Eclipse may prompt for restart it self, you can restart).
 

Step 7 : Locate android and update sdk : 
After installation, we will see this two icon in the tool bar as well as menu under Window.

When we click window > Preferences , we will see android.
Now, click window > Android SDK manager to get latest SDK tools
And, you may Click window > Android Virtual Device Manager to make your desired Virtual device.
 

So, now we are done with Android SDK setup. We may develop or test android codes.

Note : Now a days, android sdk can be downloaded as bundle(Android SDK+eclipse).

Thanks...:)