在旧版本的Android中,应用程序的大小正在增加

问题描述 投票:0回答:1

我的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'

感谢您的帮助。在此先感谢!

android performance android-studio
1个回答
0
投票

在发布版本中启用最小化,并以签名捆绑包(yourApp.aab)上传您的应用

上传应用捆绑包的好处

  • 具有较小的下载大小和较小的磁盘大小
  • 可以使用存储在APK而不是用户设备上的uncompressed native libraries(Android 6.0及更高版本),这可以减小下载大小,磁盘大小和安装时间
  • 为用户提供他们需要的功能和配置,而不是在安装过程中提供
  • 通过消除构建和发布多个APK的需求来简化构建和发布管理

[将应用程序包上传到Play控制台时,Google Play会为设备发送优化的二进制文件。

Android 5.0及更高版本:播放将生成基本APK,配置APK和动态功能APK(如果适用)

Android 5.0以下]:播放会在服务器端生成多个APK

© www.soinside.com 2019 - 2024. All rights reserved.