Including other Eclipse Projects in an Android application project

*爱你&永不变心* 提交于 2019-12-03 13:23:53

Android projects don't get packaged in, unfortunately. If your library project only has classes, not resources, then you can make it a normal Java project. Java projects that an Android project depends on do get packaged in.

If the library project uses Android specific classes, then when you make it a Java project you also have to add android.jar to the build path. This will be "platforms/android-1.6/android.jar" inside your SDK directory if you have the 1.6 platform installed, for example.

If the library is a regular Java project, the easiest way to include it in an Android project is using a linked source folder. In the application project, go to Configure Build Path | Source | Link Source... Name the folder something like library-src and point to the src folder of the library project.

I had a similar problem (with the VerifyError exception on loading onto a device) using Eclipse Version: 3.6.2. I had created an android Library project with some common classes for sharing, that depended on the android SDK classes. Instead of making the andrloid library project a 'normal' java project I added the library project as a library reference in the projects properties Android tab for the projects that were using the library. This resolved the missing class exception.

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