Исключение при попытке получить уведомление OneSignal на уровне Android API ниже 26 - PullRequest
0 голосов
/ 07 февраля 2019

Сегодня я заметил, что мое приложение перестало получать уведомления от OneSignal на устройствах до Oreo (уровень API ниже 26).При попытке отладки я заметил, что это исключение выдается, когда я должен получить уведомление.

Rejecting re-init on previously-failed class java.lang.Class<com.onesignal.JobIntentService$JobServiceEngineImpl>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/app/job/JobServiceEngine;
    at android.content.Intent com.onesignal.NotificationExtenderService.getIntent(android.content.Context) (NotificationExtenderService.java:212)
                at boolean com.onesignal.NotificationBundleProcessor.startExtenderService(android.content.Context, android.os.Bundle, com.onesignal.NotificationBundleProcessor$ProcessedBundleResult) (NotificationBundleProcessor.java:456)
                at com.onesignal.NotificationBundleProcessor$ProcessedBundleResult com.onesignal.NotificationBundleProcessor.processBundleFromReceiver(android.content.Context, android.os.Bundle) (NotificationBundleProcessor.java:430)
                at com.onesignal.NotificationBundleProcessor$ProcessedBundleResult com.onesignal.GcmBroadcastReceiver.processOrderBroadcast(android.content.Context, android.content.Intent, android.os.Bundle) (GcmBroadcastReceiver.java:125)
                at void com.onesignal.GcmBroadcastReceiver.onReceive(android.content.Context, android.content.Intent) (GcmBroadcastReceiver.java:72)
                at void android.app.ActivityThread.handleReceiver(android.app.ActivityThread$ReceiverData) (ActivityThread.java:3032)
                at void android.app.ActivityThread.-wrap18(android.app.ActivityThread, android.app.ActivityThread$ReceiverData) (ActivityThread.java:-1)
                at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1557)
                at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
                at void android.os.Looper.loop() (Looper.java:154)
                at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6123)
                at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
                at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:867)
                at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:757)
            Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.job.JobServiceEngine" on path: DexPathList[[ ... ],nativeLibraryDirectories=[ ... ]
                at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
                at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
                at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
                at android.content.Intent com.onesignal.NotificationExtenderService.getIntent(android.content.Context) (NotificationExtenderService.java:212)
                at boolean com.onesignal.NotificationBundleProcessor.startExtenderService(android.content.Context, android.os.Bundle, com.onesignal.NotificationBundleProcessor$ProcessedBundleResult) (NotificationBundleProcessor.java:456)
                at com.onesignal.NotificationBundleProcessor$ProcessedBundleResult com.onesignal.NotificationBundleProcessor.processBundleFromReceiver(android.content.Context, android.os.Bundle) (NotificationBundleProcessor.java:430)
                at com.onesignal.NotificationBundleProcessor$ProcessedBundleResult com.onesignal.GcmBroadcastReceiver.processOrderBroadcast(android.content.Context, android.content.Intent, android.os.Bundle) (GcmBroadcastReceiver.java:125)
                at void com.onesignal.GcmBroadcastReceiver.onReceive(android.content.Context, android.content.Intent) (GcmBroadcastReceiver.java:72)
                at void android.app.ActivityThread.handleReceiver(android.app.ActivityThread$ReceiverData) (ActivityThread.java:3032)
                at void android.app.ActivityThread.-wrap18(android.app.ActivityThread, android.app.ActivityThread$ReceiverData) (ActivityThread.java:-1)
                at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1557)
                at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
                at void android.os.Looper.loop() (Looper.java:154)
                at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6123)
                at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
                at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:867)
                at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:757)

Иногда исключение не генерируется (особенно при использовании эмуляторов), но уведомление по-прежнему не отображаетсяup

Я использую реализацию Gradle OneSignal 3.10.6 с пользовательским сервисом NotificationExtenderService.(Любая идея о том, что может быть причиной этого? Недавно я изменил наши правила proguard проекта, но даже после того, как я отключил proguard, ошибка сохраняется.

Edit Похоже, проблема в NotificationExtenderService . Когда я отключил наш CustomNotificationExtenderService и добавил NotificationReceivedHandler, уведомления начали поступать, однако я не могу переключиться на NotificationReceivedHandler, потому что мне все еще нужно иметь возможность выбирать, какие уведомления я хочу показатьпользователю, а также тому, что показывается как предупреждение или просто как уведомление.

...