I am working on facebook analytics in phonegap platform. I am already having facebook plugins for login and sign up that is working perfectly.

Facebook plugins having it's own module. Which is path: "phonegap-facebook-plugin:FacebookLib", configuration: "release". You can see this in below gradle file.

I have tried some of the SO solutions but not worked for me.

After adding compile dependencies for facebook analytics i am getting following error.

Error Log:

Error:Execution failed for task ':transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/facebook/AccessToken.class

Here is my build.gradle.

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile project(path: "CordovaLib", configuration: "debug")
    releaseCompile project(path: "CordovaLib", configuration: "release")
    debugCompile project(path: "phonegap-facebook-plugin:FacebookLib", configuration: "debug")
    releaseCompile project(path: "phonegap-facebook-plugin:FacebookLib", configuration: "release")
    compile "com.android.support:support-v4:+"
    compile "com.google.android.gms:play-services-auth:+"
    compile "com.google.android.gms:play-services-identity:+"
    compile "com.google.firebase:firebase-core:+"
    compile "com.google.firebase:firebase-messaging:+"
    compile "com.google.firebase:firebase-crash:+"
    compile "com.google.firebase:firebase-config:+"
    compile "com.mixpanel.android:mixpanel-android:4.9.1"
    compile "com.google.android.gms:play-services-base:+"
    compile "com.google.android.gms:play-services-gcm:+"
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile('com.crashlytics.sdk.android:answers:1.3.10@aar') {
        transitive = true;
    }
1

There are 1 best solutions below

0
On

Finally i have solved the issue.

The issue is with Android Studio version.

The version of my Android Studio is 2.2.2 when i am trying to execute app with this version it's getting error.

But when i have downgraded Android Studio version 2.2.1 then all working fine and executing without error.