亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

未找到類“com.google.firebase.iid.FirebaseInstanceId”

未找到類“com.google.firebase.iid.FirebaseInstanceId”

偶然的你 2023-07-28 10:40:24
我想通過 firebase 發送通知。當我發送通知時,我的應用程序崩潰,在 logcat 中顯示這種類型的堆棧跟蹤: java.lang.RuntimeException: Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.e_agriculture10-1.apk", zip file "/data/data/com.example.e_agriculture10/code_cache/secondary-dexes/com.example.e_agriculture10-1.apk.classes2.zip"],nativeLibraryDirectories=[/data/app-lib/com.example.e_agriculture10-1, /system/lib]]    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2398)    at android.app.ActivityThread.access$1700(ActivityThread.java:135)  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.e_agriculture10-1.apk", zip file "/data/data/com.example.e_agriculture10/code_cache/secondary-dexes/com.example.e_agriculture10-1.apk.classes2.zip"],nativeLibraryDirectories=[/data/app-lib/com.example.e_agriculture10-1, /system/lib]]    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)這是我的 FirebaseMessagingService.java 類public class MyFirebaseMessagingService extends FirebaseMessagingService {public  static int NOTIFICATION_ID = 1;@Overridepublic void onMessageReceived(RemoteMessage remoteMessage) {    generateNotification(remoteMessage.getNotification().getBody(),remoteMessage.getNotification().getTitle());}
查看完整描述

2 回答

?
皈依舞

TA貢獻1851條經驗 獲得超3個贊

您可以刪除此類“GettingDeviceTokenService”并覆蓋“MyFirebaseMessagingService”類中的“onNewToken”方法。

public void onNewToken(@NonNull String your_new_token) {super.onNewToken(s);}

用你的新令牌做你想做的事


查看完整回答
反對 回復 2023-07-28
?
慕絲7291255

TA貢獻1859條經驗 獲得超6個贊

與 unownsp 的答案一起,如果您使用 proguard,這可能會有所幫助;將這些添加到您的 proguard 配置文件中:

-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.** { *; }
-keep class com.google.firebase.** { *; }


查看完整回答
反對 回復 2023-07-28
  • 2 回答
  • 0 關注
  • 194 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號