29

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
officer
  • 2,080
  • 1
  • 20
  • 29
Asad Ullah
  • 465
  • 4
  • 10

2 Answers2

87

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

sobo
  • 887
  • 8
  • 7
8

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ernest John
  • 101
  • 5