1

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?

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.