运行项目时无法合并 dex Android Studio 3.0.1



我的项目遇到了一些问题。在Android Studio 3.0中,它工作正常,但是当我更新到3.0.1时,合并dex时遇到了问题。

我清理和重建项目。我使用多德克斯启用真与依赖

怎么了:

错误:任务":app:transformDexArchiveWithExternalLibsDexMergerForDebug"的执行失败。

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: 无法合并 dex

应用级分级:

apply plugin: 'com.android.application' 
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.rotaractnepalapp.rotraconversation"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}  
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.google.firebase:firebase-database:11.0.4'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.okhttp:okhttp:2.5.0'
    implementation 'com.firebaseui:firebase-ui-database:2.3.0'
    implementation 'id.zelory:compressor:2.1.0'
    compile 'com.android.support:support-annotations:27.1.0'
}  
apply plugin: 'com.google.gms.google-services'

在 gradle 文件中添加以下依赖项

com.google.android.gms:play-services:11.4.0

清理并重建它将工作的应用程序。

我遇到了同样的问题。我尝试通过此处的说明启用 multidex,但错误仍然存在。 正如另一篇文章中所建议的那样,我还禁用了即时运行,但这没有任何影响。 我最终不得不将所有支持库从版本 27.1.0 恢复到版本 27.0.2。一旦我这样做了,错误就得到了纠正,不需要任何 multidex 配置。27.1.0 可能存在问题。

更正:我找到了一个未使用的库('android.arch.paging:runtime:1.0.0-alpha4-1'(并将其删除,然后将版本更新回27.1.0,没有问题。 由于 minSdkVersion 为 15,请务必按照为多dex 配置应用部分下的步骤 2 进行操作,以确保应用程序正在扩展多 dex应用程序类。

最新更新