简体   繁体   中英

Why is apk generated by studio smaller than command line apk

OS : Mac os

Gradle 3.0

APK generated by studio : 13 Mb

APK generated by command line using "gradle assembleDebug" : 21 Mb.

Its almost double the size for the same project with the same build.gradle file.

I have used

aaptOptions
{
    cruncherEnabled = true
}

buildTypes {
    release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

Any idea if there are parameters being passed specifically by Studio which help reduce the size?

If you build APK in Android studio connecting the phone, then Android studio removes all the resources from your drawable folder which is not applicable to that phone. That's the reason APK generated by Android studio looks smaller.

Try this, connect different resolution phone, HDPI, MDPI, XXHDPI phones while building your APK. You can find different size of APKs generated

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM