我的Android应用安装在Android版本9中时为7.3 MB,但在较低版本中,同一应用变为18 MB并且滞后太多。我不知道为什么会这样,这是在我将代码复制到新项目中时开始发生的,因为出于某种原因我不得不删除旧项目,但是我从未更改任何内容。
这是我的gradle文件:
apply plugin: 'com.android.application'
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 28
defaultConfig {
applicationId "com.mynewapp"
minSdkVersion 19
targetSdkVersion 28
multiDexEnabled true
versionCode 10
versionName "4.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'de.hdodenhof:circleimageview:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.gms:play-services-ads:18.3.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-base:17.1.0'
implementation 'com.firebaseui:firebase-ui-database:4.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
感谢您的帮助。在此先感谢!
在发布版本中启用最小化,并以签名捆绑包(yourApp.aab)上传您的应用
上传应用捆绑包的好处
[将应用程序包上传到Play控制台时,Google Play会为设备发送优化的二进制文件。
Android 5.0及更高版本:播放将生成基本APK,配置APK和动态功能APK(如果适用)
Android 5.0以下]:播放会在服务器端生成多个APK