I switched my IDE from eclipse to android studio and generated apk after some very minor changes (No class or files were added). The APK generated from eclipse was around of size 3 MB but when I generated APK from android studio, the apk size was around 5.5 MB. I even tried to clean and generate APK in Release mode but still APK size was same i.e. 5.5 MB. Is there any specific reason behind this in android studio or am I missing something ?
your problem certainly have nothing to do with Android Studio or Eclipse. It's todo with Gradle and Ant. Those are the built systems used by each respectively.
On a general approach it seems to be that the Ant build was using ProGuard to remove unused resources and classes whilst your build.gradle file is not instructing Gradle to do the same.
Trying adding the minifyEnabled to your release build, like in the example below.
PS: change the name of the proguard file to the one on your project
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With