Many developers are having issues after installing the Android 2.3 SDK – aka Gingerbread, especially when you receive an error that android_sdk/tools adb.exe is not found. In this particular case, updating the Eclipse ADT Plugin solved the issue. Older ADT plugins were still referring to SDK/tools folder. I thought I’d share my experience of the step-by-step drill, for minimum pain/pain-free setup.
(I am using JDK 1.6, Eclipse Galileo SR2)
Please note that including adb.exe path in the environment PATH variable is only necessary for accessing adb through command line.
I followed the following steps – and have a working environment on both MAC and Windows:
- I have the path to tools as well as platform-tools in the Android sdk folder set as so:
- Appended to PATH in .bashrc and referenced .bashrc from .bash_profile (MAC)
- Appended to PATH environment system variable (Windows)
- Unzipped SDK to /Developer/SDKs (Mac) and in D: on windows (after having it in C: earlier an losing everything in a crash :)) – for windows one can use the executable provided by Google.
- Install the Android Repositories and Add-ons (for Google API)
- Go to bash prompt (by clicking on Terminal in Utilities) and type android (this will open the AVD and SDK Manager (Mac)
- Click on Setup.exe inside the SDK folder (Windows)
- Select Available packages on left pane. -Open Third party add-ons and check on Google Inc for Google APIs. (I personally have unchecked everything obsolete, to add in the future IF needed)
- Click on Install Selected.
- Create AVDs
- Again bring up the AVD and SDK Manager as in the earlier step
- Click on Virtual Devices on left pane.
- Name: AVD_2.3 for level 9, 1024 MiB and click OK AVD_2.3_GA for level 9 Google API, 1024 MiB and click OK. And so on for the other levels
- Update Eclipse ADT Plugin
- Go to Eclipse ->Help->Install New Software->Link of available software, and select on the Android Plugin choices and Click on Update..(this is extremely important, otherwise you will get the error of adb not found in the next step.
- Specify Android SDK Location in Eclipse
- Select Eclipse Preferences->Android (MAC)
- Select Windows->Preferences->Android (Windows)
- Browse to the path to the SDK folder (not the tools or any other folder) and click OK. Now you MUST NOT get the adb error 🙂 If you have done everything right, you should see all the AVDs. If you do not see the AVDs which you created in step 4, close the dialog and open it again, you MUST see all AVDs which you created.
- Getting Ready to Build
- Go to your android projects. Right click on project in left pane and in properties select Android, and check on the AVD you want to run (i.e in the emulator).
- Go to Java build path on left pane and click on the library tab if you don not already have the proper library seen select Add Library, and chose the specified project. This must work, If this does not work select Add External Jars and browse to SDK/platform//android.jar. Say OK.
- Build your Android Project (from Project Menu or right click – whichever the platform allows – should be successful!) (I personally clean the project before building, esp, when I am testing a SDK for the first time :)). It is quite possible that you have no source errors but there are 2 references in Android->Java build path->Library. Remove the external jar reference and keep only the Library reference.
- Right click on your Android project->Run As->Android Application.