Should Android support libraries be compiled together in APK?

Posted on

Question :

I’m developing an Android app, which uses two libraries that Google makes available.

appcompat-v7 is used to have action bar on devices with version 2.3 or lower, since it was only added in version 3, and google-play-services to use Google Analytics services.

The point is that after I added these libraries, the final APK size jumped from 160Kb to two 2Mb. This happened because the files from these two libraries were compiled together with the APK.

My question is whether this is how it works, or whether I should configure something so that these libraries are not compiled and found in runtime.

Answer :

They have to be compiled. The only solution I know to avoid this is through extensions to the Java runtime environment, as this link explains better.

Something impractical for Android development and a bit of a hassle even in a desktop environment, since you can not guarantee that the user’s JRE will contain the extensions you’ve created.


Leave a Reply

Your email address will not be published. Required fields are marked *