0

Hello suddenly my android project shows this error

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

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Before some days everything worked fine and I just opened it again after some days and shows me this I have tried all the possible solutions I found here but nothing worked can you help me on this?

Here is my byuild.gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.fire.stmtfadmin"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}



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






dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    compile 'com.android.support:cardview-v7:+'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    implementation 'com.google.firebase:firebase-database:11.0.4'
    implementation 'com.firebaseui:firebase-ui-database:2.3.0'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
    compile 'id.zelory:compressor:2.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    compile 'com.yqritc:recyclerview-multiple-viewtypes-adapter:1.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.StevenDXC:DxLoadingButton:2.0'
    compile 'com.github.dmytrodanylyk:android-morphing-button:98a4986e56' // commit hash
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'br.com.simplepass:loading-button-android:1.12.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.google.android.gms:play-services-maps:11.0.4'
}




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

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

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


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}
Aftab H.
  • 1,517
  • 4
  • 13
  • 25
mour77
  • 11
  • 5

3 Answers3

0

To use the 11.4.0 version of Firebase, you need to add maven url to your build.gradle file like this:

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}
Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
0

This is probably because you're using the following dependencies:

compile 'com.android.support:cardview-v7:+'

where it means you want to use the latest version. The latest version 27.1.0.

Try using:

implementation 'com.android.support:cardview-v7:26.1.0'

And never use + for your dependency version. So you can reproduce and debug the same build if there is any problem in the future.

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
0

thank you all for your replies but the only solution that worked for me was to add this line to build.gradle(Module:app):

    implementation 'android.arch.lifecycle:extensions:1.1.0'

i hope this will help the others

mour77
  • 11
  • 5