您如何设置一个可以生成可用于 android 的 jar 库文件的项目? 我想为所有项目创建一个自定义库。
其他几个问题:
- 是否需要针对特定版本的 android sdk 进行编译?
- 当针对 jar 库编译 android 包时,是否将处理代码所需的类与主代码一起编译到 apk 中,还是包含整个 jar?
- 关于使用 jar 而不是直接集成代码,我需要了解哪些值得注意的优化或缺陷?
- jar 是否必须像 apk 那样签名?
最佳答案
Google 刚刚发布了处理共享库的 SDK 的新版本!
https://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject
ADT 0.9.7(2010 年 5 月)
Library projects:
The ADT Plugin now supports the use of library projects during development, a capability that lets you store shared Android application code and resources in a separate development project. You can then reference the library project from other Android projects and, at build time, the tools compile the shared code and resources as part of the dependent applications. More information about this feature is available in the Developing in Eclipse with ADT document. If you are not developing in Eclipse, SDK Tools r6 provides the equivalent library project support through the Ant build system.
关于Android Jar 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1983617/