java - Android API 28 更新后,获取 : Error while merging dex archives

标签 java android kotlin android-9.0-pie

我正在尝试将我的 Android 应用迁移到 API 28 (Android 9/P)

我遇到了 5 个无法修复的错误。我对 Android 开发还是比较陌生,我认为我可能没有最好的更新方法。

我已经尝试清理和重建,但问题仍然存在。

这是我的项目gradle:

buildscript {
    ext.kotlin_version = '1.2.61'

    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.google.gms:google-services:4.1.0'
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'io.realm:realm-gradle-plugin:5.4.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的应用程序 gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'

android {

    lintOptions {
        checkReleaseBuilds false
    }

    compileSdkVersion 28
    defaultConfig {
        applicationId "org.siku.siku"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 118
        versionName "1.0.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        multiDexEnabled true //important
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude module: 'support-annotations'
    })

    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.android.material:material:1.0.0-rc01'
    implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
    implementation 'androidx.legacy:legacy-support-core-ui:1.0.0-rc01'
    implementation 'androidx.core:core-ktx:1.0.0-rc01'
    implementation 'androidx.exifinterface:exifinterface:1.0.0-rc01'
    implementation 'androidx.vectordrawable:vectordrawable:1.0.0-rc01'
    implementation 'androidx.cardview:cardview:1.0.0-rc01'
    implementation 'androidx.browser:browser:1.0.0-rc01'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.android.gms:play-services-auth:16.0.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.amitshekhar.android:android-networking:1.0.2'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'joda-time:joda-time:2.9.9'
    implementation 'info.hoang8f:android-segmented:1.0.6'
    implementation 'io.nlopez.smartlocation:library:3.3.3'
    implementation 'com.facebook.android:facebook-android-sdk:4.35.0'
    implementation files('libs/CircleImageView-master/gradle/wrapper/gradle-wrapper.jar')
    implementation 'org.greenrobot:eventbus:3.1.1'
    testImplementation 'org.mockito:mockito-core:2.8.9'
    testImplementation 'junit:junit:4.12'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
}

apply plugin: 'com.google.gms.google-services'

repositories {
    mavenCentral()
    google()
}

我收到 5 个错误:

1- 程序类型已经存在:android.support.customtabs.ICustomTabsCallback

2- 引起:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:合并 dex 文件时出错:

3- 引起:com.android.builder.dexing.DexArchiveMergerException:合并 dex 文件时出错:

4- 原因:com.android.tools.r8.CompilationFailedException:编译未能完成

5- 由:com.android.tools.r8.utils.AbortException 引起

我一直在努力寻找有关此事的文档。 任何建议或文档链接将不胜感激。

最佳答案

也许你忘了这个:implementation 'com.android.support:multidex:1.0.3' in your dependencies

关于java - Android API 28 更新后,获取 : Error while merging dex archives,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51940442/

相关文章:

java - 搜索 ArrayList 中 Key 的总和 (Java)

java - Spark 提交失败,出现 java.lang.NoSuchMethodError : scala. Predef$.$conforms()Lscala/Predef$$less$colon$less;

java - Spring JSON View

Android ScrollView 不会滚动到底部

android - sqlite3_open_v2 ("/data/data/com.food.find/databases/mydatabase", &handle, 2, NULL) 在android中失败?

java - Kotlin上的Server-Client应用程序出现问题

java - 动画位图的绘图列表

java - 无法从 CursorWindow 读取第 0 行第 3 列。在访问数据之前确保游标已正确初始化

具有 2 种 View 类型的 kotlin recyclerview

android - Android Kotlin在RecyclerView中更改ImageView图像源