Configure eclipse to use my own Android SDK (framework.jar)

狂风中的少年 提交于 2019-11-29 00:47:06

To build SDK you should run the following commands:

make update-api
make sdk

Since the API of Android has been modified the command make update-api adds new API. The command make sdk creates SDK in out folder.

Then to start develop your applications in Eclipse using new SDK you should add this new SDK. There are 2 possibilities to do this. The first one is from the book "Embedded Android". I'll just copy it here:

Assuming you had already configured Eclipse for Android development using the in‐ structions at http://developer.android.com, you’ll need to carry out two additional steps to use your newly-built SDK. First, you’ll need to tell Eclipse the location of the new SDK. To do so, go to Window→Preferences→Android, enter the path to the new SDK in the ”SDK Location” box, and click OK. Also, for reasons that aren’t entirely clear to the author at the time of this writing, you also need to go to Window→“Android SDK Man‐ ager”, deselect all the items that might be selected except the first two under “Tools” and click on “Install 2 packages...” Once that is done, you’ll be able to create new projects using the new SDK and access any new APIs you expose in it. If you don’t do that second step, you’ll be able to create new Android projects, but none of them will resolve Java libraries properly and will, therefore, never build.

As for the second here it is:

  1. Find you new build sdk zip (for Linux it cab be found here out/host/linux-x86/sdk/)
  2. Unzip this pack into a folder
  3. Inside this folder you can find the directory which is called platforms/android-2.3.3
  4. Rename folder android-2.3.3 to <your_name>
  5. Copy this folder into the following location of the installation of your SDK Manager: android-sdk-linux/platforms
  6. Find inside this folder file build.prop and assign to the property ro.build.version.sdk any negative number: ro.build.version.sdk=-10
  7. Now run SDK Manager and you'll notice that you new sdk is added. Simply create new Eclipse project and select this sdk as a target.
Tamilarasi

Try this:

  • create new floder in your project put floder name="libs"
  • and include the library here.
  • And Run the app
  • I hope it's working

This is a good question! Your tip would be useful for Android Studio users as well, I guess.

Just FYI, for IntelliJ users, you can also do this:

  1. Project Settings > Modules > click Dependencies tab > click "+" button > select "JARs or Directories"
  2. Find the .jar and choose it
  3. Move the .jar on top of the list of Dependencies (even before the SDK)
  4. Change the scope to 'Provided' (not 'Compile')

By step 4, you can avoid making a huge .dex. (Your apk will not include the framework.jar.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!