实现Firebase云消息传递时出现Java.Lang.NoClassDefFoundError
c#
我正在使用 Firebase Cloud Messaging 实现推送通知,为此我在我的 AndroidManifest.xml 文件中添加了此代码
<!--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-->
但是当我尝试运行该应用程序时,它甚至在开始活动之前就抛出了该应用程序
Java.Lang.NoClassDefFoundError: 'Failed resolution of: Lcom/google/android/datatransport/runtime/dagger/internal/Factory;'
顺便说一下,我为此功能安装了两个 NuGet 包:
- Xamarin.GooglePlayServices.Base
- Xamarin.Firebase.Messaging
我试过了:
- 删除 bin 和 obj 文件夹并再次构建解决方案
- 将所有相同的家族金块包更新为相同的版本
回答
安装 Xamarin.Google.Dagger 包为我解决了这个问题。
- How did you find that the error related to the missing package?
回答
只需安装包 Xamarin.Google.Dagger。这应该够了吧。似乎它正在尝试寻找包裹但没有找到它。
THE END
二维码