Duplicate entry: com/google/firebase/FirebaseApiNotAvailableException.class

前端 未结 4 594

I have an Android project built with React-Native and employing Google Play Services (analytics, cloud messaging, ads). I\'m not explicitly using Firebase anywhere.

4条回答
  •  我在风中等你
    2020-12-31 13:11

    In my case, I was using this in app/build.gradle:

    compile 'com.google.android.gms:play-services-location:9.8.0'
    compile 'com.google.android.gms:play-services-maps:9.8.0'
    

    The error when I was trying to generate a Signed APK was:

    Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
    > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/firebase/FirebaseApiNotAvailableException.class
    

    I modified app/build.gradle by removing the two lines I mentioned above and using this instead:

    compile 'com.google.android.gms:play-services:9.8.0'
    

    Of course "play-services" is the full bundle and not an optimized way to do this. It would be best to specify the specific services that are required (read Does "play-services:9.8.0" include "play-services-location:9.8.0"?), but for now it fixes the error in my case.

提交回复
热议问题