Я просто создаю простой код
Я сделал приложение для Android с kotlin Я добавляю этот код:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
PushNotifications.start(getApplicationContext(), "my_id")
PushNotifications.addDeviceInterest("hello")
}
Это мой push-уведомление на терминале
curl -H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxxx"
-X POST "https://my_id.pushnotifications.pusher.com/publish_api/v1/instances/my_id/publishes"
-d '{"interests":["hello"],"fcm":{"notification":{"title":"Hello","body":"Hello, world!"}}}'
{"publishId":"pubid-myid"}
когда я пытаюсь отправить уведомление на терминал, мои приложения принудительно закрываются
Вот мое сообщение об ошибке
I/FCMMessageReceiver: Got a valid pusher message.
I/art: Rejecting re-init on previously-failed class java.lang.Class<com.pusher.pushnotifications.fcm.MessagingService$WrappedFirebaseMessagingService>
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.muffin.cobanotif, PID: 11211
java.lang.NoClassDefFoundError: com.pusher.pushnotifications.fcm.MessagingService$WrappedFirebaseMessagingService
at com.pusher.pushnotifications.fcm.MessagingService.<init>(MessagingService.kt:72)
at com.pusher.pushnotifications.fcm.EmptyMessagingService.<init>(MessagingService.kt:108)
at java.lang.Class.newInstance(Native Method)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2866)
at android.app.ActivityThread.access$1900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1434)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
И мои зависимости:
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.pusher:push-notifications-android:1.4.3'