I am building a NativeScript project. I have been using @nativescript/firebase in the project, successfully, for some time. I have since tried to add OneSignal Android SDK to the project and I received the following error:
Execution failed for task ':app:checkDebugDuplicateClasses'.
Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules jetified-firebase-iid-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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.zzs found in modules jetified-firebase-iid-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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-20.0.2-runtime.jar (com.google.firebase:firebase-iid:20.0.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 <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
I then tried adding the gradle plugin, thinking this could solve it and it has indeed resolved the issue. However, now when my app loads I get the following error:
System.err: TypeError: Cannot read property 'firebase' of undefined
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3654)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806)
System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
System.err: at android.os.Handler.dispatchMessage(Handler.java:107)
System.err: at android.os.Looper.loop(Looper.java:237)
System.err: at android.app.ActivityThread.main(ActivityThread.java:8167)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
The issue appears to be with OneSignal depending on com.google.firebase:firebase-iid, which subsequently defines com.google.android.gms.internal.firebase_messaging which clashes with the same class now defined inside of com.google.firebase:firebase-messaging. I also believe that com.google.firebase:firebase-iid which is now deprecated?
Are there any resolutions to this at all because I'm at a complete loss, or would I be right in thinking that until OneSignal stops using com.google.firebase:firebase-iid, the issue will always exist to me?
Please Add The Following
Project Setup
build.gradle
app/build.gradle
I am building a NativeScript project. I have been using
@nativescript/firebase
in the project, successfully, for some time. I have since tried to add OneSignal Android SDK to the project and I received the following error:I then tried adding the gradle plugin, thinking this could solve it and it has indeed resolved the issue. However, now when my app loads I get the following error:
The issue appears to be with OneSignal depending on
com.google.firebase:firebase-iid
, which subsequently definescom.google.android.gms.internal.firebase_messaging
which clashes with the same class now defined inside ofcom.google.firebase:firebase-messaging
. I also believe thatcom.google.firebase:firebase-iid
which is now deprecated?Are there any resolutions to this at all because I'm at a complete loss, or would I be right in thinking that until OneSignal stops using
com.google.firebase:firebase-iid
, the issue will always exist to me?Apologies if any of my assumptions are incorrect.
Thanks,
Tom