How to reduce Apk (.apk) size in android studio

后端 未结 8 1553
春和景丽
春和景丽 2021-01-03 09:50

When i run my app size of apk will 21 MB. even i enabled proguard. i use android studio to run project. in project files src folder has 8.62 MB size and lib folder size is 4

相关标签:
8条回答
  • 2021-01-03 10:52

    try

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

    shrinkResources true will not include the images from resources which your using in the final apk

    hope this helps

    0 讨论(0)
  • 2021-01-03 10:55

    I think you should build your APK as (APK bundle), Google promotes that for APK size issues. I've used the option for my projects and it did actually decrease the size of my APK.

    0 讨论(0)
提交回复
热议问题