简体   繁体   中英

Unable to MergeDex in Android Studio after updating Firebase and Google play services

The error which I am receiving is this:

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

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

My build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "app.monmos"
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner      "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    }
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),   'proguard-rules.pro'
    }
    }
    buildToolsVersion '27.0.3'
    productFlavors {
    }
    }
    android {
    defaultConfig {
    multiDexEnabled true
     }
      }
   dependencies {
   implementation fileTree(include: ['*.jar'], dir: 'libs')
  implementation 'com.github.jd-alexander:android-flat-button:v1.1'
//Libraries
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-messaging:12.0.0'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
 implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:12.0.0'
implementation 'com.google.firebase:firebase-database:12.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.firebaseui:firebase-ui-database:3.1.1'
}
apply plugin: 'com.google.gms.google-services'

This is my project build.gradle project:

    buildscript {

        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
            classpath 'com.google.gms:google-services:3.1.0'


            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

allprojects {
repositories {
    google()
    jcenter()
    maven { url "https://jitpack.io" }
 }
 }

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

I have updated the firebase version from 10.2.0 to 12.0.0 and the app is bringing up an error saying telling me to merge dex. I think 2 libraries are clashing.

This is because the following Firebase-UI:

implementation 'com.firebaseui:firebase-ui-database:3.1.1'

Has a strict dependencies of:

  • Firebase/Play services version 11.6.2
  • Support Library version 27.0.1

So, you need change the dependencies according to it.

You can view the documentation in case you need to use the recent supported Firebase/Play service at Firebase-UI for Android .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM