1

i'm having a probleme when creating the APK
When i run the app, it works fine but when i build the apk it says

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/location/places/PlaceReport.class

gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.1'
    useLibrary 'org.apache.http.legacy'
    configurations {

    }


    defaultConfig {
        applicationId "inc.exemple"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
                  'proguard-rules.pro'
        }
    }
}
repositories {
    mavenCentral()
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:25.0.0'

    compile 'com.android.support:design:25.1.1'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
    compile 'com.1gravity:android-rteditor:1.6.2'
    compile 'com.github.irshulx:laser-native-editor:0.3.5'
    compile 'com.github.arturogutierrez:badges:1.0.5@aar'
    compile 'com.mikepenz:actionitembadge:3.3.1@aar'
    compile 'com.mikepenz:iconics-core:2.8.1@aar'
    compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
    compile 'com.synnapps:carouselview:0.0.10'
    compile 'com.google.firebase:firebase-messaging:9.8.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}

I believe i should exlude it, but i don't know how, please help, thank you.

Samir Acoustic
  • 49
  • 1
  • 10
  • Your code does not compile the places Play Services, so I think you should empty out your libs folder – OneCricketeer Mar 11 '17 at 23:25
  • @cricket_007 i just deleted them, it still giving the same problem, so i'm cleaning the project and i will try again and see – Samir Acoustic Mar 11 '17 at 23:44
  • 1
    You can run `gradlew app:dependencies` to inspect which dependencies you have. From that, look at which are duplicated and cut them out. See this post for details. http://stackoverflow.com/questions/24026378/unable-to-see-dependency-tree-with-gradlew-or-gradle – OneCricketeer Mar 11 '17 at 23:49
  • @cricket_007 i have found `com.google.android.gms` package but i didn't declare it anywhere! i deleted the libs but they come back after the build any idea why it is persisting? – Samir Acoustic Mar 12 '17 at 11:11
  • Firebase includes it. You should be able to see that when running that command. However I don't think `places` library from your error would come from there – OneCricketeer Mar 12 '17 at 12:40
  • 1
    @cricket_007 the error was coming from the `'com.github.irshulx:laser-native-editor:0.3.5'`, it worked after i deleted it, thanks a lot! – Samir Acoustic Mar 12 '17 at 12:59
  • 1
    Did you really need that library at all? Why did you have it? And the version number on that was really old. https://github.com/irshuLx/Android-WYSIWYG-Editor – OneCricketeer Mar 12 '17 at 15:47
  • @cricket_007 yes i needed it, but when it caused a problem i had to find a way around – Samir Acoustic Mar 13 '17 at 18:22
  • But you said it worked when you removed it, which means there was no code in your app using that library... – OneCricketeer Mar 13 '17 at 18:23
  • 1
    @cricket_007 i copied only the libs into a new empty project and i started removing one by one to find where the problem comes from, then i replaced this library with a work around – Samir Acoustic Mar 15 '17 at 11:03
  • Got it. Please feel free to answer with your solution below so that others may find it, and not have to read the comments. – OneCricketeer Mar 15 '17 at 11:05
  • @cricket_007 okay i will , thank you – Samir Acoustic Mar 15 '17 at 11:33
  • Possible duplicate of [Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'](http://stackoverflow.com/questions/33209631/errorexecution-failed-for-task-apptransformclasseswithjarmergingfordebug) – Yatin Mar 15 '17 at 11:49
  • 1
    @Yatin This question has been solved. That is not the same solution there. – OneCricketeer Mar 15 '17 at 12:32
  • @Yatin the answer at that link is bogus despite being accepted. – Almo Apr 05 '17 at 19:33

1 Answers1

2

So i had to create a new empty project and copy all the libs in it, and try one by one to find which one was containing the problem. the error was coming from the com.github.irshulx:laser-native-editor:0.3.5, it worked after i deleted it, then i modified the whole project and used another work around.

Samir Acoustic
  • 49
  • 1
  • 10