- Fatal Exception: android.app.RemoteServiceException Bad notification posted from package:* Couldn’t create icon: StatusBarIcon #1875
- Comments
- renatop7 commented Feb 12, 2020
- Your Environment
- Expected Behavior
- Actual Behavior
- Steps to Reproduce
- Context
- Debug logs
- renatop7 commented Feb 19, 2020
- Simbaclaws commented Jun 29, 2020 •
- renatop7 commented Jun 30, 2020
- Simbaclaws commented Jun 30, 2020 •
- GitFr33 commented Jul 27, 2020
- Simbaclaws commented Jul 27, 2020 •
- Как исправить: android.приложение.RemoteServiceException: плохое уведомление, отправленное из пакета *: не удалось создать значок: StatusBarIcon
- 17 ответов
- Error: android.app.RemoteServiceException: Bad notification posted from package com.sergiuiacob.words: Couldn’t create icon: StatusBarIcon #178
- Comments
- sergiuiacob1 commented Mar 6, 2019 •
- sergiuiacob1 commented Mar 6, 2019
- sergiuiacob1 commented Mar 6, 2019
- MaikuB commented Mar 6, 2019
- sergiuiacob1 commented Mar 7, 2019
- sergiuiacob1 commented Mar 7, 2019
- MaikuB commented Mar 7, 2019
- MaikuB commented Mar 7, 2019
- sergiuiacob1 commented Mar 7, 2019
- MaikuB commented Mar 7, 2019
- MaikuB commented Mar 8, 2019
- sergiuiacob1 commented Mar 9, 2019
- eggenstein commented Mar 23, 2019
- eggenstein commented Mar 23, 2019
- eggenstein commented Mar 23, 2019
- sergiuiacob1 commented Mar 23, 2019
- MaikuB commented Mar 23, 2019
- MaikuB commented Mar 30, 2019
- sergiuiacob1 commented Mar 30, 2019
Fatal Exception: android.app.RemoteServiceException Bad notification posted from package:* Couldn’t create icon: StatusBarIcon #1875
Comments
renatop7 commented Feb 12, 2020
My app is crashing when showing a local notification on Samsung devices using Android 8.1.
I tested using an emulator on Android 8.1 and everything is fine, I’m guessing this is a problem with Samsung, anybody knows what can be done to solve this problem?
Your Environment
- Plugin version: 0.9.0-beta.2
- Platform: Android
- OS version: 8.1
- Device manufacturer / model: Samsung Galaxy J7 Prime
- Cordova version ( cordova -v ): 9.0.1
- Cordova platform version ( cordova platform ls ): 8.1.0
- Plugin config: «cordova-plugin-local-notification»: <>
- Ionic Version (if using Ionic): @ionic-native/core: 5.18.1-beta.5
Expected Behavior
Show a notification
Actual Behavior
Steps to Reproduce
Send a local notification, app crashes immediately
Context
Send a local notification
Debug logs
Include iOS / Android logs
This is what showed in Firebase Crashlytics stacktrace:
The text was updated successfully, but these errors were encountered:
renatop7 commented Feb 19, 2020
@katzer any idea why is this happening?
Simbaclaws commented Jun 29, 2020 •
I’m currently having the same issue, have you resolved this already somehow?
Apparently capacitor’s local notifications work, but when I try to use this plugin I’m greeted with the same error message as you do above.
The thing is capacitor’s local notifications doesn’t have a badge option, which I need to use.
renatop7 commented Jun 30, 2020
I’m currently having the same issue, have you resolved this already somehow?
Apparently capacitor’s local notifications work, but when I try to use this plugin I’m greeted with the same error message as you do above.
The thing is capacitor’s local notifications doesn’t have a badge option, which I need to use.
Yes. I manually fixed the plugin.
I’m going to copy my fix here but be aware that:
I didn’t fork this project so I changed the files inside the Android’s platform folder to be easier to test my modifications.
If you do the same remember to backup the modified files before reinstalling this plugin again (if you ever do) because you gonna lose all changes made.
Simbaclaws commented Jun 30, 2020 •
What I did to fix the issue was set a correct smallIcon in the local notification properties.
Apparently the default icon for the local notification causes issues.
EDIT: Presumably because it is not white?
GitFr33 commented Jul 27, 2020
I’m running into the same problem. What did you set the smallIcon to that fixed it @Simbaclaws? I tried setting it to false and to res://calendar as it shows in the read me but I’m still getting this error.
Simbaclaws commented Jul 27, 2020 •
@GitFr33 It was: res://mipmap-xxxhdpi/ic_stat_zin.png
Where ic_stat_zin.png was a icon that has transparency and is pure white. The name of the file may differ.
If you do not make an icon that is pure white it will not work, as there are configurations in android to color the icon in xml. Or in the case of localnotification this is done through a function call if I’m not mistaken.
This is also the reason why the notification icon generator in android asset studio only generates white icons.
https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart&source.clipart=ac_unit&source.space.trim=1&source.space.pad=0&name=ic_stat_ac_unit
(I hope this doesn’t sound racist, it’s just how google made it work for notifications)
The location of where to put this icon is in: /android/app/src/main/res/mipmap-xxxhdpi/ this can be any of the mipmap directories, I went for the biggest one because it would guarantee quality on all screens. I think res:// points to /android/app/src/main/res/ but I haven’t tested whether it’ll work with custom directories yet.
Since there was no documentation I kind of figured this out on my own through some logical reasoning.
I basically looked at how native apps do it. And also the word res (which I assume is resource) gave it away.
Источник
Как исправить: android.приложение.RemoteServiceException: плохое уведомление, отправленное из пакета *: не удалось создать значок: StatusBarIcon
Я вижу следующее исключение в лог-файл:
я отправляю свое уведомление из IntentService из набора PendingIntent через AlarmManager, используя следующий метод. Все значения, переданные здесь, из дополнительных пакетов в PendingIntent / IntentService.
из того, что я видел из других ответов — исключение, которое я вижу, происходит, когда setSmallIcon() вызывается неправильно.
Я проверил и дважды проверил, что передаваемые идентификаторы ресурсов верны.
17 ответов
то, что происходило, было, я включал целочисленную ссылку на значок в пакете PendingIntent, и это целое число позже ссылалось во время публикации в NotificationManager.
между получением целочисленной ссылки и ожидающим намерением, приложение было обновлено, и все drawable ссылки изменились. Целое число, которое использовалось для ссылки на правильный drawable теперь ссылается на неправильный drawable или none at all (none at all — причина этого сбоя)
С помощью VectorXml внутри вашего уведомления, как известно, вызывает эту проблему. Используйте png
У меня была такая же проблема каждый раз, когда я хотел показать уведомление о Kitkat. Что вызвало проблему для меня, так это то, что я определил каждый значок в xml (из svg), маленький значок и значок действия. После того, как Я заменил их png-s, проблема решена на моей стороне.
android.приложение.RemoteServiceException: плохое уведомление опубликовано
у меня была такая же проблема, но я был непреклонен. Моя проблема «.xml-файл » удаленного просмотра.
в моем xml-файле мне был добавлен один View между LinearLayout для делителя.
выше View компонент, создающий исключение Bad notification. Причиной исключения является только xml-файл Remoteviews.
после удаления этого компонента представления мой код выполнено правильно, без каких-либо исключений. Поэтому я почувствовал, что ящик уведомлений не принимает никаких настраиваемых представлений.
таким образом, вы не рисуете ничего, как показано выше.xml-файл
в моем приложении, такая ошибка происходит только во время обновления. Если идентификатор ресурса изменяется в более новой версии, Android RemoteView может не найти ресурс и выкинуть RemoteServiceException . Если вы опубликуете 3-ю версию и не измените идентификатор ресурса, ошибки могут исчезнуть временно.
можно уменьшить этот вид ошибок путем редактирования res/values/public.xml и res/values/ids.xml . Компилятор создаст индивидуальный идентификатор ресурса, если его нет в public.xml или ids.xml . При изменении имени ресурса или добавлении новых ресурсов идентификатор может измениться, и некоторые устройства могут не найти его.
таким образом, шаг выглядит следующим образом:
- декомпилировать файл apk и в res/values найти public.xml и ids.xml
- найдите все ресурсы, связанные с RemoteView в вашем приложении и скопируйте их ( строки, dimen, drawable, layout, id, color. )
- создать public.xml и ids.xml под res/values в свой источник код и вставьте линии U просто скопировал
Gradle 1.3.0 и выше игнорируют локальный public.xml . Чтобы заставить его работать, нужно добавить скрипт в build.gradle
Примечание.: Этот сценарий не поддерживает проект подмодулей. Я пытаюсь это исправить.
Источник
Error: android.app.RemoteServiceException: Bad notification posted from package com.sergiuiacob.words: Couldn’t create icon: StatusBarIcon #178
Comments
sergiuiacob1 commented Mar 6, 2019 •
Hey! I’ve been using this package to send daily notifications in my app. Some devices (Xperia X Compact, Galaxy Note 8) have been receiving this error:
Do you have any ideas why this would happen? I created the notification icon by creating a new Image Asset called icon_notification inside Android Studio then using it like so:
What I’ve managed to find out so far is that the error occurs when the app is cleared from memory.
Using version 0.5.2
The text was updated successfully, but these errors were encountered:
sergiuiacob1 commented Mar 6, 2019
It might be important HOW I’m sending these notifications. My daily notification has today’s date as its body. Therefore, I am scheduling 30 different notifications. See here why.
sergiuiacob1 commented Mar 6, 2019
Is it possible that something like this happens:
- Creating the notificationDetails in memory somewhere, at address A .
- Scheduling first notification that uses notificationDetails from address A .
- Clearing the app from memory. At address A there isn’t any notificationDetails anymore.
- Showing the first notification. Scheduling the second with notificationDetails from address A . But I don’t have notificationDetails at the A address! Therefore it can’t create the notification icon.
I have no idea if this makes sense or not, but I’m in the process of brain-storming 😄
MaikuB commented Mar 6, 2019
Your hypothesis is something that could easily be validated and is something I’ve already tested whilst developing the plugin. This could be done by scheduling the notification and terminating the app before the notification is shown to see if it will show up around the time it got scheduled for.
I suspect the resource ID for your icon had changed between when the notification for scheduled (which is when the plugin tries to get it) and when the notification is about to be shown. I’m not sure how this is happening in your scenario (maybe the app got updated). Do you have steps to reproduce? I’ve got an idea on a solution (resolve the id for the icon just before showing the notification). Will look into creating a branch for this that you could try out when I get the chance to. If you’d be willing to assist in testing this then that would be much appreciated.
What kind of image are you using for the notification icon? I assume it’s been replaced under /resources/drawable?
sergiuiacob1 commented Mar 7, 2019
The source image for the icon is a 512×512 PNG file. The app was indeed updated.
Previously, there was the 1.3 version. I wasn’t specifying any custom icon for the notifications. The current version is 2.0, where I created an Image Asset for my custom notification icon. So yeah, the app was indeed updated.
My OnePlus 3T has a thing called «Deep Clear» for when clearing the recent apps. I enabled that, I scheduled a notification and then cleared everything. The notification wasn’t even shown. That’s normal behaviour, however, I believe.
I’d be glad to help you out 🙂 but I’m unsure of how to test this.
sergiuiacob1 commented Mar 7, 2019
Oh, something important which I forgot to mention: the crash occurs even at the first notification scheduled.
MaikuB commented Mar 7, 2019
Let me get back to you. It might be possible to test without your involvement but initial thought was if you have a created a beta release for your app in the Google Play store
- you could release the current version to beta, install it and schedule notifications
- release an updated beta version of the app that will reference an updated version of this plugin
- test to see if notifications still appear
This may not be required although it would be a more realistic test. I’m going to see if resource IDs remain the same or change when a debug build is redeployed to the same device. If it changes then I could reproduce the scenario more easily
MaikuB commented Mar 7, 2019
I’ve missed the other message when I replied but when you say the app crashes even at the first notification, does that happen even when the app is running? I’ve actually installed your app and tried to schedule notifications whilst it was running and that was fine. I also scheduled it and terminated the app and notifications still appeared. This was on a Pixel 2 XL
sergiuiacob1 commented Mar 7, 2019
Actually, I gave it some thought. That comment might not be so important as I thought. I asked somebody who had an Xperia X Compact to schedule a notification. It worked for him when the app was in foreground. But scheduling a notification and closing the app resulted in a crash for him. I don’t know if the crash is from showing the first notification or from scheduling the second.
I, myself, couldn’t replicate the issue with an OnePlus 3T.
MaikuB commented Mar 7, 2019
Sounds like the same scenario as me I can’t reproduce the issue with your app as well. I did a fresh install though
MaikuB commented Mar 8, 2019
I’ve pushed a branch (https://github.com/MaikuB/flutter_local_notifications/tree/178). May be worth trying out in your app by referencing through git and specifying the branch as per this link. However, some of the issues you’ve described where closing the app causes a crash may be due to something, possibly not to do with this plugin even
sergiuiacob1 commented Mar 9, 2019
I need to first find somebody with either a Xperia X Compact or a Galaxy Note 8 and test this out. I could easily build an apk with the branch above.
eggenstein commented Mar 23, 2019
I may have the same issue. I get reports in Google Play Store only (I cannot reproduce it on any of my devices or emulators).
My logs don’t have any details on the exception though:
android.app.RemoteServiceException:
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1881)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6944)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
One important point is that this only happens for Android 8.0.
And only Galaxy A5+A6 so far. My sample is rather small though.
eggenstein commented Mar 23, 2019
Maybe related or maybe not. They talk about notifications, too, but also about Services.
Solution for android.app.RemoteServiceException ?
eggenstein commented Mar 23, 2019
Maybe also related:
They talk about resource IDs changing because of app upgrade and then an old alarm triggering a notification with an old resource ID. Maybe my solution for re-scheduling notifications after app upgrade could help: Notifications lost after app update on Android?
sergiuiacob1 commented Mar 23, 2019
I may have the same issue. I get reports in Google Play Store only (I cannot reproduce it on any of my devices or emulators).
My logs don’t have any details on the exception though:
android.app.RemoteServiceException:
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1881)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6944)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
One important point is that this only happens for Android 8.0.
And only Galaxy A5+A6 so far. My sample is rather small though.
I also had reports for this issue on Android 7.1, so it doesn’t happen only for 8.0
MaikuB commented Mar 23, 2019
@eggenstein i had already made change to not save resource ids but was trying to see if i could get help from others to check if it solves the issue. I’ve seen mixed messages on if things scheduled through the alarm manager would be lost on an app update but that IMO is a separate issue
MaikuB commented Mar 30, 2019
I’ve released a new version that should now store the name of the resources as opposed to the ids that i’m pretty certain is what caused. Unfortunately the fix will only retroactively apply to notifications that were scheduled that don’t use the default icon specified via the initialize . Based on the code you’ve posted @sergiuiacob1, I believe this fix should work in your case since you’ve specified the icon per notification
sergiuiacob1 commented Mar 30, 2019
I’ll take a look at this when I’ll update the app. I’ll try to do a test before and after the package update. Thank you for the notice!
Источник