App size differs in different Android versions
I was reading a lot about different application sizes after installation. EG: Why apk size increase in different android version
But something I still do not understand. I have an application (com.onhost.skuska made in LibGDX) and on Android 4.3 . immediately after the installation (eg with no extra data) it takes 17.54 MB and on Android 5.0 , Galaxy S6 it takes 30.73 MB .
At first I thought it is about different hardware or screen resolution. I have tried to install the app on Genymotion emulator of S4 with Android version 4.3 and it was more or less 17.5 MB. When I installed the application on my S4 with Android 5.0 the app size after installation increases to 29.21 MB.
I have investigated actual files (using find -name "skuska" on terminal) after installation. On Android 5.0, Galaxy S6 (Genymotion) the main folders and files are these:
Files on Android 4.3 are as follows:
As we can see the main difference is in the .dex file. I would like to ask you if there is any way how to make size of .dex file the same as on Android 4.3? Or why there are two times *.so files in Android 5.0?
Thank you very much for any suggestion to solve this issue.
EDIT: I do use Proguard for shrinking (no optimisation or obfuscation). EDIT 2: I also checked some other apps not programmed in LibGDX and their 5.0 version is bigger but not so dramatically.
The reason they are different sizes is because Android 5.0 has additional features which are included in the classes.dex for compatibility reasons (even if you're not using them). This is also sometimes called boilerplate code. Also, if you have two different installations that are both signed differently but that use the same app name (com.onhost.skuska) then android will install both of them, and not overwrite the first one, and instead add a -1 to the end (com.onhost.skuska-1) etc.
/data/dalvik-cache/x86/data@app@com.onhost.skuska-1@base.apk@classes.dex is a cached file and is used to speed up the loading of commonly used applications so that the apk file doesn't have to be extracted each time.
链接地址: http://www.djcxy.com/p/66916.html