Multiple Android SDKs in Eclipse
The traditional and supported way to accomplish this is via the use of multiple workspaces, each one configured for a different SDK revision.
However, you can accomplish this in an alternative eclipse fashion, using Eclipse "Installed JREs".
Here's what it looks like from a Packaging Explorer point of view...
Pay attention to the project definitions and icons here ...
- flagged as Android projects (the lowercase 'a' icon on the project folder)
- not using the nebulous 'Android Library' build path library
You can start using this technique by specifying a few Installed JREs in your Window / Preferences.
A Typical View when first starting out ..
Lets start adding a new Android JRE.
- Choose 'Add' button.
- You will see the "Add JRE / JRE Type" dialog.
- Select "Standard VM" from the options.
Select 'Next' button and you are presented with an empty "Add JRE" dialog.
- Browse to a "JRE Home" that is a Sun (not IBM, not GCJ) Java 1.5 (not 1.4, not 1.6) location.
The dialog will auto populate based on information in the browsed JRE Home.
You will see something like the following ...
Now you need to make some modifications here ...
- Remove all of the JRE System Library entries in the dialog.
- Change the "JRE Name" to something useful, like "Android 1.0"
- Choose "Add External JARs..." and pick the Android.jar from your SDK installation directory.
You should have something that looks like this ...
TIP: You can even specify an Android-src.jar to help navigate into the source code during debugging.
Vote for
Issue 979 - Please provide a simple android-src.jar for debugging in eclipse if you want to see this jar be part of the official SDK releases.
Example of this setup (I built my own source jar) ...
Now continue to setup the other Android SDKs you have and you might end up with something like this ...
We're almost done.
Now we need to tell our projects to use these newly created Android JREs.
- Open up the project's properties view.
- Goto the "Java Build Path" entry.
- Navigate to the "Libraries" tab.
- Remove any Library entries for "Android Library" or "JRE System Library".
- Now use the "Add Library" button.
- Pick "JRE System Library" from the options.
- Push "Next" button
- And pick an "Alternate JRE" of the Android Library you created earlier.
- Save your changes.
You are now done.





Issue



