Firebase Messaging and Android API level 17

Today I was trying to integrate my Andorid app with Firebase Cloud Messaging to provide push notifications functionallty.

I had to add the following dependency to my build.gradle file to make the FirebaseMessagingService abstract class available:

compile 'com.google.firebase:firebase-messaging:9.6.0'

Unfortunately I have got the following error message when trying to build the app:

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

It seems that the issue do not occur when you use API level 19 or higher as the minSdkVersion. However I need to have my application compatible with Android 4.2.2 which uses API level 17.

The solution was pretty simple, but I haven’t found any info about that in the documentation. It works like a charm after adding the firebase-core dependency:

compile 'com.google.firebase:firebase-core:9.6.0' // add this line
compile 'com.google.firebase:firebase-messaging:9.6.0'

The another option is to use some older version of firebase-messaging dependency:

compile 'com.google.firebase:firebase-messaging:9.0.2'
Posts created 16

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top