开发者

Including and Excluding Libs at Run Time

In my new Android app, I'm required to use a library when Android Version in 1.6 and 1.5 and include some other library when the version is more than 1.6. I know how to get the Android SDK version, but I'm stuck at inclusion of 开发者_开发知识库specific library at run time. Any Help ??


Libraries are included in your APK file. As such you cannot remove libraries from the APK at runtime.

As far as loading classes at runtime is concerned, you can always do that, but the content of the APK (the JARs / classes you include in them is static). You are offcourse free to load particular classes from it based on the API level.

If you're worried about the file-size of your APK, and you want to optimize the APK packaging and tweak your app based on the capabilities of the device of the consumer of your app, you should checkout this link :

http://android-developers.blogspot.com/2011/07/multiple-apk-support-in-android-market.html

It allows you to target different APKs based on device capabilities (ex: API level). That way, you can create 2 APKs with the specific libraries you want to use for a specific API level.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜