Gradle Build Run error (DebugUtils.class) in Android Studio 1.5 - android

I'm getting the following error
Error:Execution failed for task
:app:transformClassesWithJarMergingForDebug.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/util/DebugUtils.class
I searched the entire day but couldn't found a proper answer which will solve my problem.
My app bulid gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.project.test"
multiDexEnabled true
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
// depend files
dependencies
{
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-ads:+'
compile 'com.google.android.gms:play-services-identity:+'
compile 'com.google.android.gms:play-services-gcm:+'
compile files('libs/android-support-v4.jar')
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
}
I tried Clean and Rebuild, but that also not working.
Please help on this. Thanks in advance.

This issue happens when you add the same class twice.
In your project you are adding many times the support-v4 library.
remove android-support-v4.jar from libs folder
remove this line compile files('libs/android-support-v4.jar')
change the dependency of the library 'com.github.JakeWharton:ViewPagerIndicator:2.4.1' because it uses an old support-v4.jar
Use:
compile ('com.github.JakeWharton:ViewPagerIndicator:2.4.1') {
exclude module: 'support-v4'
}

After doing some research it seams that com.github.JakeWharton:ViewPagerIndicator:2.4.1 is already importing the android-support-v4.jar, from here your duplicate error. In order to fix it I recommend you to do the following changes:
remove android-support-v4.jar from libs folder
remove from gradle file the line compile files('libs/android-support-v4.jar').
Hope it fixes your problem.

Related

Build Failed 'duplicate entry: com/google/api/client/googleapis/auth/clientlogin/ClientLogin$Response.class

Error description:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/api/client/googleapis/auth/clientlogin/ClientLogin$Response.class
build.gradle code here
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '23.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.jasp.eventapp"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.8.2'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.couchbase.lite:couchbase-lite-android:1.4-46'
//compile 'com.google.api-client:google-api-client-android:1.22.0'
//compile 'com.google.api-client:google-api-client-xml:1.22.0'
compile 'com.google.api.client:google-api-client:1.4.1-beta'
compile 'com.google.api-client:google-api-client-jackson2:1.22.0'
compile files('libs/google-api-client-1.5.0-beta.jar')
compile 'com.google.android.gms:play-services:9.2.1'
}
Any version problem in imported libs...?How can I handle this...?I tried by cleaning the project
Build - > Clean
after that rebuild, But no effect...Can any one please help me...
This error occurs when you are using duplicate version of same library, or when you use a library project which has same dependency
compile 'com.google.api.client:google-api-client:1.4.1-beta'
compile 'com.google.api-client:google-api-client-jackson2:1.22.0'
compile files('libs/google-api-client-1.5.0-beta.jar')
these three looks like same library , removing duplicate version of the library should fix your error
I had the same problem with Feign library. Look in the .idea\libraries directory in your project, find the same library with different versions and remove one. It should be help.

Duplicate entry error in my Android app

This error occurs when I sync the gradle file
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/client/android/camera/CameraConfigurationUtils.class
I tried cleaning the project, rebuilding the project and multidex, excluding the module.
My min sdk is 19. If greater than 20, multidex worked properly,
but in SDK 19 it didn't work.
This is my gradle build file:
apply plugin: 'com.android.application'
android
{
compileSdkVersion 24
buildToolsVersion '25.0.2'
defaultConfig
{
applicationId "com.example.prototype_01"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes
{
release
{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.google.android.gms:play-services-appindexing:9.6.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
compile 'com.google.zxing:core:3.2.0'
compile 'com.github.bumptech.glide:glide:3.5.1'
//compile files('libs/android-core-3.2.1.jar')
compile 'com.android.support:support-v4:24.2.1'
compile 'com.tsengvn:Typekit:1.0.0'
compile 'com.google.firebase:firebase-messaging:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
What can be done to solve this issue?
It is not related to Multidex.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/client/android/camera/CameraConfigurationUtils.class
It means that you are adding the same class CameraConfigurationUtils.class twice.
Check your jar files.
If you have libs/android-core-3.2.1.jar you are adding twice the same class.
This class is inside the jar and inside the library compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'.
Remove the jar file from the libs folder.
duplicate entry: com/google/zxing/
You've added too many libraries. Try removing one at a time until your app can build.
Start with removing any conflicting Jar files from libs related to Zxing
Zxing core is not necessary, the embedded one already compiles it
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
// compile 'com.google.zxing:core:3.2.0'
Multidex / changing your SDK version isn't going to magically fix overlapping dependencies

While adding any new dependencies in android build.gradle file. it always show an error

Error:(42, 13) Failed to resolve: com.android.volley:volley:1.0.0
When add any dependencies in android build.gradle file it always shows the above error. But same project is running on a different machine same dependencies can add successful. I search lot for solving this problem but can't find any solution. Kindly Please help me to fix the problem Thank you.
I face the same error while adding any dependencies now, but few weeks before i can add any dependencies on my project
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "myappid"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter({url "http://jcenter.bintray.com/"})
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:support-vector-drawable:24.0.0'
// VectorDrawableCompat
compile 'com.android.support:animated-vector-drawable:24.0.0'
compile 'com.android.support:support-annotations:24.0.0'
compile 'com.satsuware.lib:usefulviews:2.3.6'
compile 'com.github.ganfra:material-spinner:1.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.ramotion.foldingcell:folding-cell:1.0.1'
compile 'com.android.volley:volley:1.0.0'
}
I try many way to solve the problem i have faced but no one can rectify the problem. I ask the help of may experience developer, they told me that they never face such a problem in there life. So only solution i found is to reinstall android studio. Now it work perfectly. Any way thanks for your support.

Error In Notification Parse

Please Help
This Error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/parse/ParseFacebookUtils$1.class
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.eaglegroup.hmusic"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile files('libs/Parse-1.12.0.jar')
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
And This ScreenShot
http://upload7.ir/u/preview/s1/GMUCEmdE.png
I had the same problem that happened to you. I solved it by doing the following steps.
In your project's app/libs folder, remove the below files and folder.
ParseFacebookUtilsV3-1.10.4-javadoc (It's a folder)
ParseFacebookUtilsV3-1.10.4.jar (An Executable jar file)
ParseFacebookUtilsV3-1.10.4.jar.properties (A Properties file)
By doing this, I solved mine. I think this should help.

duplicate library gradle animatorlistener duplicate

I'm trying to use some libraries into my android project and I'm facing some problems with different libraries. I have a library which I import from maven repository that has "nineoldandroids" library dependency. After that I have another import that uses the same library and I did a exclude of that module. Now if I sync Gradle everything works fine but when I try to run my app I get the following error
"Error:Class com.nineoldandroids.animation.Animator.AnimatorListener has already been added to output. Please remove duplicate copies."
I think that both libraries are trying to use the same Listener and I get that error but I'm not able to solve it and I didn't find useful information for me. If somebody can help me I would appreciate it. This is my gradle file. BTW last library must be manually included and it's placed in my "libs" folder.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.infortec.acostela.pescamerca"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories{
jcenter()
flatDir {
dirs 'libs'
}
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.+'
compile "com.android.support:gridlayout-v7:18.0.+"
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'commons-net:commons-net:3.3'
compile 'net.sf.opencsv:opencsv:2.3'
compile 'com.rengwuxian.materialedittext:library:1.8.2'
compile ('libs.example:material:0.4.3#aar'){
exclude module: 'nineoldandroids'
}
}
Finally I solved it.
The problem was that I must exclude the whole library, not only the module so writing the following solved it.
compile ('com.rengwuxian.materialedittext:library:1.8.2'){
exclude group: 'com.nineoldandroids', module: 'library'
}

Categories

Resources