Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I got the following error
This is my build gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.ryan.mychatapp"
minSdkVersion 21
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 {
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-storage:11.2.0'
//noinspection GradleCompatible
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.android.support:support-v4:26.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
testImplementation 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
compile 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.firebaseui:firebase-ui-database:2.1.1'
compile 'id.zelory:compressor:2.1.0'
}
This is my another build gradle
// 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
}
I already added multiDexEnabled true, but the error keep popping up. I already tried, clean and rebuild, but none of it is working, what should I do? I not sure what is wrong with my gradle? I pasted my whole gradle in this post.
Let me know which part should I change
You're mixing implementation and compile, use simply implementation for all your dependencies as compile has been deprecated. Also update your gradle plugin.
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// 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'
}
dependencies {
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-storage:11.2.0'
//noinspection GradleCompatible
implementation 'com.google.android.gms:play-services:11.2.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.firebase:firebase-database:11.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:11.2.0'
implementation 'com.google.firebase:firebase-database:11.2.0'
implementation 'com.google.firebase:firebase-messaging:11.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.firebaseui:firebase-ui-database:2.1.1'
implementation 'id.zelory:compressor:2.1.0'
}
Related
I tried adding this dependency...
implementation 'com.google.android.gms:play-services-auth:16.0.0'
but it says:
Could not resolve com.google.android.gms:play-services-auth:16.0.0.
Here is my app level gradle file:
apply plugin: 'com.android.application'
android {
buildToolsVersion "27.0.3"
compileSdkVersion 27
defaultConfig {
applicationId "com.example.newu.fireapp"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint layout:1.1.2'
implementation 'com.firebase:firebase-client-android:2.5.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.firebaseui:firebase-ui-database:1.1.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:21.+'
implementation 'com.android.support:recyclerview-v7:21.+'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
And here's my top-level build file :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.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://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Try to add this library
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//firebase stuff
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
//Google Play Services
implementation 'com.google.firebase:firebase-core:11.8.0'
If you haven't already, you need to make sure you have added the google repository to your gradle configuration:
repositories {
google()
}
I'm developing my app with firebase
But I have the following problem when I made Build the project
Error
My Module App Gradle is that
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "pt.ipca.projectoaddjn"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.android.support:support-v4:26.1.0'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.android.support:cardview-v7:26.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:percent:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.firebaseui:firebase-ui:0.6.2'
}
apply plugin: 'com.google.gms.google-services'
And My project app is this
// 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'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I do not know if the problem is in this compile 'com.firebaseui:firebase-ui:0.6.2' I just had this problem when I added this complile
Or the problem may be related to the fact that I have multiple compiles,.
Thanks.
Change compile for implementation, compile has been deprecated.Finally, you should match the firebase version with the firebase ui version, see the github.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.google.firebase:firebase-database:11.4.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.firebase:firebase-core:11.4.0'
implementation 'com.google.firebase:firebase-auth:11.4.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:percent:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.firebaseui:firebase-ui:2.4.0'
}
I am working in a project and apparently it throws exception Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
here is my app build.gradle:
apply plugin: 'com.android.application'android {
compileSdkVersion 27
defaultConfig {
applicationId "app.ayon.visiterbook"
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}}dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.sdsmdg.tastytoast:tastytoast:0.1.1'}
and my gradle file:
buildscript
{
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}}allprojects {
repositories {
google()
jcenter()
}}task clean(type: Delete) {
delete rootProject.buildDir}
It's a warning that google has changed compile to implementation and api, compile will removed at end of 2018
so Just change your compile into implementation like
to
compile 'com.android.volley:volley:1.0.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.sdsmdg.tastytoast:tastytoast:0.1.1'
this
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.intuit.sdp:sdp-android:1.0.3'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.sdsmdg.tastytoast:tastytoast:0.1.1'
Changing the compile to implementation in build.gradle file works for me.
I read a lot other topics, but none of them helped me.
I wrote this project 2 months ago and at that time everything worked fine. Now I opened it again and it writes:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Here is my app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.szabo.organizer"
minSdkVersion 21
buildToolsVersion "27.0.2"
targetSdkVersion 27
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:customtabs:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.facebook.android:facebook-login:4.29.0'
implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'com.github.bumptech.glide:glide:4.5.0'
implementation 'com.google.android.gms:play-services-auth:12.0.0'
implementation 'com.google.android.gms:play-services-maps:12.0.0'
implementation 'com.google.firebase:firebase-database:12.0.0'
implementation 'com.google.firebase:firebase-storage:12.0.0'
implementation 'com.google.firebase:firebase-auth:12.0.0'
implementation 'com.google.firebase:firebase-core:12.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.5.0'
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'
}
apply plugin: 'com.google.gms.google-services'
and the project gradle:
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()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I changed all "compile" to "implementation", I deleted .gradle directory, I tried clean project and rebuild, I tried Invalidate and restart.
Use this
implementation 'com.firebaseui:firebase-ui-database:3.3.0'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-storage:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
Instead of this
implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'com.google.android.gms:play-services-auth:12.0.0'
implementation 'com.google.android.gms:play-services-maps:12.0.0'
implementation 'com.google.firebase:firebase-database:12.0.0'
implementation 'com.google.firebase:firebase-storage:12.0.0'
implementation 'com.google.firebase:firebase-auth:12.0.0'
implementation 'com.google.firebase:firebase-core:12.0.0'
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
this error appeared since it was updated to android 3.0
build.gradle (Module:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.0'
defaultConfig {
multiDexEnabled true
applicationId "com.example.samue.radiostatus"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
javaMaxHeapSize "4g"
}
}
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'
})
testCompile 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.github.snowdream.android:smartimageview:0.0.2'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
implementation 'com.mcxiaoke.volley:library-aar:1.0.1'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:support-v4:26.+'
testCompile 'junit:junit:4.12'
implementation files('libs/httpmime-4.3.jar')
implementation files('libs/android-smart-image-view-1.0.0.jar')
implementation files('libs/activation.jar')
implementation files('libs/additionnal (1).jar')
implementation files('libs/android-async-http-1.4.9.jar')
implementation files('libs/javamail-mailapi-1.4.2.jar')
implementation files('libs/javamail-smtp-1.4.2.jar')
implementation files('libs/mail (1).jar')
}
build gradle (project):
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is because you have duplicates dependencies. You can't mix the same dependency from repositories and from local jar files. So, you need to clean up your app build.gradle. And also, don't use + for dependencies. Use exact version of dependencies. This is because you can't specify a problem for a library if you don't know its exact version.
You need to clean up your build.gradle to something like this:
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'
})
testCompile 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.github.snowdream.android:smartimageview:0.0.2'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
implementation 'com.mcxiaoke.volley:library-aar:1.0.1'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation files('libs/httpmime-4.3.jar')
//implementation files('libs/android-smart-image-view-1.0.0.jar')
implementation files('libs/activation.jar')
implementation files('libs/additionnal (1).jar')
//implementation files('libs/android-async-http-1.4.9.jar')
implementation files('libs/javamail-mailapi-1.4.2.jar')
implementation files('libs/javamail-smtp-1.4.2.jar')
implementation files('libs/mail (1).jar')
}