- Create a new Android project, then follow these steps.
- Right-click the project and choose
Build Path -> Configure Build Path
. - Click the Libraries tab.
- Click Android 2.2 (or whatever version is shown) and then click the Remove button.
- Click Add Library... , select User Library and click Next .
- Click User Libraries... .
- Click New... , then type in "Android" or "Android 2.2" as you like.
- With your new library selected in the center pane, click Add JARs... and navigate to your Android SDK; find android.jar . For example, mine is on the path C:/Users/russ/dev/android-eclipse/android-sdk-windows/platforms/android-8/android.jar .
- Click the android.jar and then Open . This adds the Android SDK JAR to your library. It's the only JAR you need.
- Now expand your new library by clicking on the triangle to the left of its name. You should see android.jar . Expand android.jar similarly to reveal a list of 4 items.
- Double-click Source attachment: , choose External Folder... and then navigate to (or simply type in the path) to the subdirectory source you just downloaded and click OK . Click OK a second time, then a third to dismiss the User Libraries dialog.
- With the new Android SDK library set up (including source code), check its box in the User Library dialog and click Finish . The library should be added to your project (in place of the one that the Android SDK Eclipse plug-in added automatically when you created the project).
- Right-click the project and choose
ref: http://www.javahotchocolate.com/tutorials/android.html