我的APK非常大。如何减小它的尺寸?
我的版本APK以20.009 MB(!!)。
刚刚创建了一个非常简单的Android应用程序,将其基于Android Studio Project Project模板之一。我的应用程序只是扫描条形码:-)
这是我的依赖项:
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'
}
这是我的版本构建参数:
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
从依赖项可以看出,我添加了ML套件。根据 https://developers.google.com/ml-kit/视觉/条形码扫描/Android ,它不应添加超过3.2 MB。
我运行了大小分析仪,它告诉我:
找不到尺寸的节省建议。
那这里怎么了?为什么我的APK如此庞大?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论