Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task :app:checkDebugDuplicateClasses FAILED java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.firebase_messaging.zza found

The app was working perfectly when I did some changes last time. but suddenly getting the issue of firebase.

implementation project(':react-native-firebase')
    implementation 'com.android.support:support-v4:+'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation project(':react-native-device-info')
    implementation project(':react-native-vector-icons')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    ..... other dependencies
    implementation 'com.google.firebase:firebase-messaging:16.1.0

getting error

Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzb found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzc found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzd found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zze found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzf found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzh found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzm found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzn found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzo found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzp found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzq found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.android.gms.internal.firebase_messaging.zzr found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)
Duplicate class com.google.firebase.iid.FirebaseInstanceIdReceiver found in modules jetified-firebase-iid-17.1.2-runtime.jar (com.google.firebase:firebase-iid:17.1.2) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)

Go to the documentation to learn how to Fix dependency resolution errors.
like image 698
ajay 24 Avatar asked May 13 '21 07:05

ajay 24


2 Answers

I had same problem here, suddenly android stop work. I'm using react-native 0.61.5.

Here three ways you can solve this issue:

First way: (solved my problem) On your android/build.gradle add this line to ext section:

firebaseVersion = "21.1.0"

Second way: (also solved my problem) If the first way not work, maybe you should have to do a little bit more. In your android/buld.gradle:

  firebaseMessagingVersion = "21.1.0"
   buildToolsVersion = "29.0.2"
   firebaseCoreVersion = "17.0.0"
   firebaseVersion = "21.1.0"

on your android/app/build.gradle, add this:

implementation 'com.google.firebase:firebase-messaging:21.1.0'

Third way

You will need to find all dependencies of firebase that are brake your application, pay attention for you node_modules dependencies that are using something related to firebase. Once you have all dependencies mapped, you will need to specify versions on your android/build.gradle and android/app/build.gradle.

Notes: Sorry for my english, i tried.

like image 150
Marcelo Guimarães Avatar answered Oct 27 '22 00:10

Marcelo Guimarães


i was having this issue, i found that firebase-iid worked on the same version than firebase-messaging, but now the messaging version is 22.0.0 and the mayor version of firebase-iid is 21.1.0, so yo have to separate the dependencies with each corresponding version.

like image 23
Nicolas Beltrami Avatar answered Oct 26 '22 23:10

Nicolas Beltrami