Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java.Lang.NoClassDefFoundError when implementing firebase cloud messaging

I am implementing push notifications using Firebase Cloud Messaging, for this I added this code in my AndroidManifest.xml file

<!--FCM RECEIVER-->
<receiver
  android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
  android:exported="false"/>
<receiver
  android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
  android:exported="true"
  android:permission="com.google.android.c2dm.permission.SEND">
  
  <intent-filter>
    <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
    <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
    <category android:name="${applicationId}"/>
  </intent-filter>    
</receiver>
<!---FCM RECEIVER ENDS HERE-->

but when I try to run the application, it throws the application even before starting the activity

Java.Lang.NoClassDefFoundError: 'Failed resolution of: Lcom/google/android/datatransport/runtime/dagger/internal/Factory;'

By the way, I had Installed two NuGet Packages for this functionality:

  1. Xamarin.GooglePlayServices.Base
  2. Xamarin.Firebase.Messaging

I have tried:

  1. deleting the bin and obj folder and building the solution again
  2. updating all the same family nugget packages to the same version
like image 680
Asad Ullah Avatar asked Dec 20 '20 15:12

Asad Ullah


2 Answers

Installing the Xamarin.Google.Dagger package solved this problem for me.

like image 188
sobo Avatar answered Nov 07 '22 21:11

sobo


Just Install the package Xamarin.Google.Dagger. That should do the trick. Seems it's trying to look for the package but doesn't find it.

like image 8
Ernest John Avatar answered Nov 07 '22 19:11

Ernest John