Unable to merge dex in my project 's gradle - android

I got this error when i have tried to rebuild my project:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Despite i have added this line
multiDexEnabled true
in my app module gradle file, the error become as below.
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [C:\Users\Amine\AndroidStudioProjects\Movies\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\Amine\AndroidStudioProjects\Movies\app\build\intermediates\transforms\desugar\debug\19.jar(;;;;;;**.class)] (Duplicate zip entry [19.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
Also I have cleaned after rebuilded the project, but I have the same issue.
Below , the gradle of my app module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.0'
defaultConfig {
applicationId "com.aoutir.mohamed.movies"
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'
}
}
buildTypes.each {
it.buildConfigField("String", "MOVIES_END_POINT", "\"https://api.themoviedb.org\"")
it.buildConfigField("String", "APPIKEY", "\my API Key")
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
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'
})
compile 'com.android.support:recyclerview-v7:27.0.0'
compile 'com.android.support:cardview-v7:27.0.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:27.+'
compile 'com.android.support:design:27.0.1'
testCompile 'junit:junit:4.12'
}
Below the gradle file of my project module:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Thanks in advance for any help.

This is because you have duplicated support library. The source of the problem is the + usage for version. You should not use this:
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support:support-v4:27.+'
because gradle will use the latest version of 27 which is 27.1.0 (Take a look at Recent Support Library Revisions). Then your dependencies block will be something like this:
dependencies {
//...
compile 'com.android.support:recyclerview-v7:27.0.0'
compile 'com.android.support:cardview-v7:27.0.0'
//...
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support:support-v4:27.27.1.0'
}
which is a totally different version.
But wait, you also use the following:
compile 'com.android.support:design:27.0.1'
which is a different version again. The real problem is this, support design library is implicitly using appcompat-v7 and support-v4 library. So, the above line is the same as this:
compile 'com.android.support:design:27.0.1'
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support:support-v4:27.0.1'
The solutions for your problem is, you need to use same version of support library. Something like this:
dependencies {
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
// adding appcompat-v7 and support-v4 is not necessary
//when using support design.
// ...
}

Related

"Unable to merge dex" error when update to Android Studio 3.0?

This error appears after I updated to Android Studio 3.0. I tried many ways in many similar questions, but nothing works.
Here is the error:
I realized that when I remove the library 'com.google.android.gms:play-services-maps:11.4.2' my project build successful. But I need this library in my project, anyone knows how to deal with this problem?
My complete build.gradle.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "vn.com.ttsoft.dhd"
minSdkVersion 21
targetSdkVersion 25
versionCode 14
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
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'
})
compile files('libs/android-async-http-1.4.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/gson-2.3.1.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.github.pavlospt:roundedletterview:1.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.evernote:android-job:1.1.8'
testCompile 'junit:junit:4.12'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
}
I am putting the gradle file you can use it may help you
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "vn.com.ttsoft.dhd"
minSdkVersion 14
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'
}
debug {
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile files('libs/android-async-http-1.4.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/gson-2.3.1.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
compile 'com.github.pavlospt:roundedletterview:1.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.evernote:android-job:1.1.8'
testCompile 'junit:junit:4.12'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
}
apply plugin: 'io.fabric'
and another project gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
I was also facing the same issue and I think something is wrong with google play services dependencies so I got it resolved by adding all below google play services dependencies :
compile 'com.google.android.gms:play-services-base:11.4.2'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.google.android.gms:play-services-gcm:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
I had a similar problem with the 'Multiple Dex' build error after upgrading to AS 3.0 / Gradle 3.0.0.
I found that the invalidate caches and restart, clean project, and minifyEnabled "solutions" were all red herrings.
I struggled with this for a few hours then found out what was causing my problem.
I was compiling Picasso, GSON and SQLiteAssetHelper using the statements
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.picasso:picasso:2.5.2'
...but I also had the sqliteassethelper, GSON and Picasso .jar files being compiled from my \libs folder.
compile fileTree(include: ['*.jar'], dir: 'libs')
Hence the duplicates.
Yes - pretty obvious but sometimes you can't see the wood for the trees!
I hope this helps someone.
(Final Note: compile command is deprecated in Gradle 3.0.0, therefore you might wish to change the above commands from compile to implementation)
What version of Play Services do you load from file? I guess that's an issue, you try to load whole play services and partial play-services-maps together. Also that explains the fact that, when you remove maps, everything works fine.
take a look on this link for selective compiling play services APIs, this will also help to reduce method count
https://developers.google.com/android/guides/setup
To somebody who is using android-async-http and had tried enable DEX, invalidate cache, delete .gradle files and check duplicate import/version:
I have some conflict in org.apache and android-async-http packages,
after I change i.e. org.apache.http.Header
to cz.msebera.android.httpclient.Header, my problem solved.
{
useLibrary 'org.apache.http.legacy' // avoid this
}
dependencies {
compile files('libs/android-async-http-1.4.4.jar') // only keep this one
}

Getting error building App: app:transformDexArchiveWithDexMergerForDebug

I get the following error while building the app in android studio, why this is happening? Is it related to my proguard rules or dexguard rules?
when I add " multiDexEnabled true" in build.gradle file, I get below error:
Error:Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException:
java.nio.file.NoSuchFileException:
D:\android\app\build\intermediates\multi-dex\debug\maindexlist.txt
But, when I add " multiDexEnabled true" in build.gradle file, I get below error:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
flatDir { dirs 'D:/DexGuard-8.0.17/lib' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.1'
classpath ':dexguard:'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'dexguard'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.c.android"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
}
buildTypes {
debug {
proguardFile 'D:/android/app/proguard-project.txt'
proguardFile 'dexguard-project.txt'
}
release {
proguardFile 'D:/android/app/proguard-project.txt'
proguardFile 'dexguard-project.txt'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs'
})
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:design:26.1.0'
compile 'com.google.android.gms:play-services-base:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
compile 'com.android.support:support-v13:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.specyci:residemenu:1.6'
compile 'com.basgeekball:awesome-validation:2.0'
compile 'com.bahmanm:persianutils_2.10:1.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.6'
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
compile('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true
}
compile 'com.google.guava:guava:23.3-android'
}
Delete your build folder inside "app/"
i can not see the multidex library
implementation 'com.android.support:multidex:1.0.3'
if you add this to dependencies in build.gradle file in your first case the problem should be solved
caution: if target SDK is set to higher than 21 there is no need for any of this
There is some dependency issue with your project, please check dependency with help of this answer. And you will know which library is being problematic.

Android studio build issue Google sign in and Firebase latest version 10.2.4

Android studio build issue Google sign in and Firebase latest version 10.2.4
google sign in was working fine until I have put firebase jar in gradle and its throwing "Error:(149, 28) The type com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable cannot be found in source files, imported jack libs or the classpath"
below is app level build
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "viksit.com.viksit.pro.viksitpro"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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'
}
android {
useLibrary 'org.apache.http.legacy'
}
compile project(':linkedin-sdk')
compile(group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1') {
exclude group: 'xpp3', module: 'xpp3'
}
compile('com.udojava:EvalEx:1.0') {
exclude group: 'junit', module: 'junit'
}
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.android.support:appcompat-v7:25.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile 'com.afollestad.material-dialogs:commons:0.9.4.2'
compile 'com.google.firebase:firebase-database:10.2.4'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-auth:10.2.4'
compile 'com.google.android.gms:play-services-auth:10.2.4'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.android.support:support-v4:25.0.2'
compile 'com.felipecsl:gifimageview:2.1.0'
compile 'me.itangqi.waveloadingview:library:0.3.5'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.android.support:design:25.3.0'
compile 'com.github.vipulasri:timelineview:1.0.5'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
compile 'com.truizlop.sectionedrecyclerview:library:1.2.0'
compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
compile 'link.fls:swipestack:0.3.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
testCompile 'junit:junit:4.12'
}
below is project level build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Looks like you skipped this step
apply plugin: 'com.google.gms.google-services' line be at the bottom of your app/build.gradle file
https://developers.google.com/android/guides/google-services-plugin
Sidenote: You have Glide and Picasso, two-way gif drawable libraries, and two shaped imageview libraries. Each pair do the same thing. Clean out your dependencies to reduce your app size and chances of errors
I had a similiar problem with firebase yesterday and this worked for me:
Just add this to gradle file and rebuild it:
android {
....
dexOptions {
// Prevent OutOfMemory with MultiDex during the build phase
javaMaxHeapSize "4g"
}
}

gradle dependency version conflict

I have the following dependency script:
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.asdf.asdf"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildTypes.each {
it.buildConfigField 'String', 'YOUTUBE_API_KEY', YoutubeApiKey
}
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0-beta-2'
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:0.13.2'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
javanano {
option 'ignore_services=true'
}
}
task.plugins {
grpc {
option 'nano=true'
}
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:support-annotations:23.2.1'
compile 'com.android.support:customtabs:23.2.1'
compile 'com.google.apis:google-api-services-youtube:v3-rev164-1.21.0'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'io.grpc:grpc-protobuf-nano:0.13.2'
compile 'io.grpc:grpc-okhttp:0.13.2'
compile 'io.grpc:grpc-stub:0.13.2'
compile 'com.google.guava:guava:18.0'
}
Though both the youtube library and the grpc library are dependent on the google guava library, they're reliant on different versions causing a conflict. Youtube is dependent on com.google.guava:guava-jdk5:17.0 and grpc on com.google.guava:guava:18.0.(Notice the artifact difference, if that is possibly relevant) The problem is grpc ends up trying to locate a method defined in youtube's version of guava when it only exists in in its own version of the dependency. How do I resolve this?
ERROR Message
FATAL EXCEPTION: SyncAdapterThread-1
Process: com.asdf.asdf, PID: 4025
java.lang.NoSuchMethodError: No static method directExecutor()Ljava/util/concurrent/Executor; in class Lcom/google/common/util/concurrent/MoreExecutors; or its super classes (declaration of 'com.google.common.util.concurrent.MoreExecutors' appears in /data/data/com.fentale.dalol/files/instant-run/dex/slice-guava-jdk5-17.0_a8ada10dcaf113cb6e3b4d3e5b46975833f8ae8f-classes.dex)
at io.grpc.internal.ClientCallImpl.<init>(ClientCallImpl.java:100)
at io.grpc.internal.ManagedChannelImpl$RealChannel.newCall(ManagedChannelImpl.java:320)
at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:299)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:130)
at com.fentale.dalol.nano.DalolGrpc$DalolBlockingStub.topPosts(DalolGrpc.java:365)
The method "directExecutor" is defined in guava-v18, but grpc tries to access it from the guava-jdk5.
I would try to exclude guava-jdk5 by using
exclude module: 'guava-jdk5'
in your dependencies.
The problem is that version conflicts cannot be detected if the artifacts have different names (like here, guava and guava-jdk5). Then it can happen that the wrong classes are loaded because both jars are included.
Specify the guava version manually
compile 'com.google.guava:guava:18.0.0'
So your dependencies will be the following
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.google.apis:google-api-services-youtube:v3-rev164-1.21.0'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'io.grpc:grpc-protobuf-nano:0.13.2'
compile 'com.google.guava:guava:18.0.0'
}
That way you will force guava v18 to be used.
Or in the top level gradle you can use
configurations.all {
resolutionStrategy.force 'com.google.guava:guava:18.0.0'
}
You have to edit project level build.gradle you have to
exclude module: 'guava-jdk5'
inside dependencies. Please check attached screenshot for more details
If you are using firebase plugins add
classpath ('com.google.firebase:firebase-plugins:1.1.0') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}

java.util.zip.ZipException: duplicate entry: android/support/v7/graphics/drawable/DrawableUtils.class

I just updated my support library from 23.0.0 to 23.1.0 and now when I build the project, I get this error :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/graphics/drawable/DrawableUtils.class
Here is my app level build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23"
defaultConfig {
applicationId 'com.galleri5.android'
multiDexEnabled true
minSdkVersion 16
targetSdkVersion 23
versionCode 6
versionName "0.6"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:design:23.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.3.0'
compile 'com.etsy.android.grid:library:1.0.5'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.clans:fab:1.6.1'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
}
What am I getting this error? I want to use the latest version of support library. How can I fix this issue? I read this SO thread and the solution didn't work. It gave more errors in my codebase. Also, I am not using JARs. Any help would be highly appreciated. Thanks.
I ran into the same problem in my React Native Android project, and this is what made it work for me:
cd android
./gradlew clean
You need to add the exclude group: on your support V7 like this one:
compile ('com.android.support:appcompat-v7:19.+' ) {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'com.android.support'
}

Categories

Resources