任务':app:mergeExtDexDebug'的执行失败。在实施Firebase消息传递时

时间:2019-07-13 14:28:46

标签: android firebase-cloud-messaging

我遇到以下错误->在我的项目中实施实现'com.google.firebase:firebase-messaging:19.0.1',它开始给我以下错误。

com.android.build.api.transform.TransformException:java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:合并dex存档时出错:   程序类型已经存在:androidx.versionedparcelable.NonParcelField

下面是我的Gradle文件。

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId 'XXXXXX'
        minSdkVersion 19//21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.google.zxing:core:3.2.1'
    implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
    implementation 'com.microsoft.azure.android:azure-storage-android:2.0.0@aar'
    implementation 'com.googlecode.json-simple:json-simple:1.1'
    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'

//    implementation 'com.google.firebase:firebase-core:17.0.0'
//    implementation 'com.mani:ThinDownloadManager:1.4.0'
    implementation 'com.mindorks.android:prdownloader:0.5.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    /*implementation 'com.android.support:multidex:1.0.3'
    implementation ('com.google.firebase:firebase-messaging:19.0.1') {
        exclude group: 'com.android.support'
    }*/
}
//apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:2)

我通过在Gradle文件中添加compileOptions解决了该问题

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}