0

My release APK comes out at whopping 20.009 MB (!!).

Just created a really simple Android app, basing it on one of the Android Studio project templates. My app just scans a barcode :-)

Here are my dependencies:

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'com.google.mlkit:barcode-scanning:17.0.2'

    def camerax_version = "1.1.0-beta01"

    implementation "androidx.camera:camera-camera2:${camerax_version}"
    implementation "androidx.camera:camera-lifecycle:${camerax_version}"
    implementation "androidx.camera:camera-view:${camerax_version}"

    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.navigation:navigation-fragment:2.4.2'
    implementation 'androidx.navigation:navigation-ui:2.4.2'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Here are my release build parameters:

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

As is evident from the dependencies, I have added the ML kit. According to https://developers.google.com/ml-kit/vision/barcode-scanning/android, it shouldn't add more than 3.2 MB.

I ran the size-analyzer, and it tells me:

No size saving suggestions found.

So what's going on here? Why is my APK so colossal?

HelloWorld
  • 3,381
  • 5
  • 32
  • 58
  • Hello, World. Which app size are you looking at, the final signed and build .apk? Did you try opening the apk with a zip archiver, and checking the size of each individual architecture? – George Jun 15 '22 at 19:04
  • @George thanks! app-release-unsigned.apk. I guess signing it wont make a difference. I looked inside the zip. Seems there's a libbarhopper_v3.so taking 3-5 MB per CPU target. Guessing that's the barcode scanner lib from the ML kit. – HelloWorld Jun 15 '22 at 19:07
  • 1
    Hi my Friend, check this answer it is very useful for your question https://stackoverflow.com/a/36540976/11654799 – Azmi radi Azmi Jun 15 '22 at 19:35

0 Answers0