Search code examples
androidfirebasefirebase-in-app-messaging

InApp Messaging Error


It gives me Unable to merge dex error. If i comment dependency of InApp Messaging then it works fine.

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.1'

classpath 'com.google.gms:google-services:4.0.0'

classpath 'com.android.tools.build:gradle:3.0.1'

Let me know if any solution available for it.


Solution

  • classpath 'com.android.tools.build:gradle:3.1.4'

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.firebasedatabasedemo"
            minSdkVersion 16
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
            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:multidex:1.0.3'
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.google.firebase:firebase-core:16.0.1'
        implementation 'com.google.firebase:firebase-database:16.0.1'
        implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'
    
    
    }
    apply plugin: 'com.google.gms.google-services'
    

    It's solved by changing gradle dependency to 3.1.4 version & by integrating multidex.