如何解决如何避免在相当简单的Android应用中使用Multidex?
我正在开发一个相当简单的应用程序,它没有太多的依赖关系(但是有些依赖关系很复杂),并且在开发过程中,我达到了无法再构建该应用程序的地步,因为非Multidex中的类数量最多已到达应用程序(最大数量为65.536)。
我一直在使用minifyEnabled true
(否则,我将使用接近80.000,而不是当前的68.822类),我的应用程序大小约为11MB(已安装)。
如何避免使用Multidex进一步减少方法数量?
我应该在exclude
文件中使用build.gradle
一词吗?
还是应该修改我的保障规则?
这是我对应用模块的build.gradle配置:
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
}
}
...
dependencies {
implementation filetree(dir: 'libs',include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
implementation "androidx.preference:preference-ktx:1.1.1"
implementation 'com.afollestad.material-dialogs:core:3.3.0'
implementation 'com.afollestad.material-dialogs:bottomsheets:3.3.0'
implementation 'com.amitshekhar.android:android-networking:1.0.2'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0'
implementation 'com.github.AppIntro:AppIntro:6.0.0'
implementation 'com.github.cyb3rko:about-icons:master-SNAPSHOT'
implementation 'com.github.GrenderG:Toasty:1.5.0'
implementation 'com.github.medyo:android-about-page:1.3'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.firebase:firebase-analytics-ktx:17.6.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.2.2'
implementation 'com.mikepenz:aboutlibraries-core:8.3.0'
implementation 'com.mikepenz:aboutlibraries:8.3.0'
implementation 'org.adw.library:discrete-seekbar:1.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
以下是gradle插件的来源:
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
classpath 'com.google.gms:google-services:4.3.4'
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:8.3.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
感谢答案!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。