0

I am trying run my app at emulator but I got his error:

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

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

This is my gradle file:

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


android {
     compileSdkVersion 26
     buildToolsVersion '26.0.2'
     defaultConfig {
     multiDexEnabled true
     applicationId "com.example.sayres.presencesystem"
     minSdkVersion 16
     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'
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.1'

}

and this:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'
    classpath 'com.google.gms:google-services:3.0.0' // google-services plugin

}
}

allprojects {
repositories {
    jcenter()
    maven { url 'http://maven.fabric.io/public' }
    google()
}
}

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

according some siggestion on some post I have added multiDexEnabled true to my gradle but I still got error. some developers at this site had suggested, rebuild project.I did this suggestion but I did work and I still got this error!! what is your suggestion? I still did this suggestion

but did not work again. I do not have too many methods.I have just 2 activity and a few methods.my project is for learning.

Groot
  • 177
  • 1
  • 2
  • 10
  • use `classpath 'com.google.gms:google-services:3.1.1'` then `clean-Rebuild-run`. – IntelliJ Amiya Nov 19 '17 at 14:03
  • @IntelliJAmiya I got this error: `Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.` – Groot Nov 19 '17 at 14:07
  • I have installed google play service 46 – Groot Nov 19 '17 at 14:08
  • Could you tell me what is `46`? – IntelliJ Amiya Nov 19 '17 at 14:10
  • At sdk tools my google play service version is 46. – Groot Nov 19 '17 at 14:12
  • You should use play service version `11.6.0` – IntelliJ Amiya Nov 19 '17 at 14:13
  • @IntelliJAmiya this is not this version at my sdk tools https://ibb.co/krioiR – Groot Nov 19 '17 at 14:18
  • `classpath 'com.google.gms:google-services:3.1.0'` – IntelliJ Amiya Nov 19 '17 at 14:20
  • @IntelliJAmiya I got this error: `Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.` again – Groot Nov 19 '17 at 14:24
  • tell me, is any module there? which having `android.gms` low version? – IntelliJ Amiya Nov 19 '17 at 14:25
  • @IntelliJAmiya I got this redline too https://ibb.co/iA3Scm – Groot Nov 19 '17 at 14:26
  • its a warning. Not error. Run your app – IntelliJ Amiya Nov 19 '17 at 14:28
  • @IntelliJAmiya I have a simple project .this is my manifest http://codepad.org/r0snFaLZ. and I do not have any module. – Groot Nov 19 '17 at 14:28
  • ok redline is warning but I still got above error `Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (informat....` – Groot Nov 19 '17 at 14:30
  • Check this question https://stackoverflow.com/questions/47195780/google-services-conflict-error – IntelliJ Amiya Nov 19 '17 at 14:34

1 Answers1

0

I change my build.gradle to :

implementation 'com.google.firebase:firebase-database:10.2.0'
implementation 'com.google.firebase:firebase-auth:10.2.0'
implementation 'com.firebaseui:firebase-ui-auth:1.2.0'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'

and

 classpath 'com.google.gms:google-services:3.0.0' // google-services plugin

my problem fixed.now I can compile my project.

Groot
  • 177
  • 1
  • 2
  • 10