1

I am having trouble with the following Error --> Implementing the implementation 'com.google.firebase:firebase-messaging:19.0.1' on my project and it start giving me below error.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Program type already present: androidx.versionedparcelable.NonParcelField

below are my Gradle file.

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'
Komal
  • 79
  • 1
  • 10

1 Answers1

2

I resolved the issue by adding compileOptions in Gradle file

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
Mayur Rathod
  • 361
  • 3
  • 13