stephanenicolas / robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Apache License 2.0
2.95k stars 545 forks source link

Android O (8.1.0) : invalid channel for service notification #473

Open MS893 opened 6 years ago

MS893 commented 6 years ago

I've got this new error for users using android 8.1.0 : "android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null..."

I can reproduce the error on emulator using API level 27.

I've found this topic : https://stackoverflow.com/questions/47531742/startforeground-fail-after-upgrade-to-android-8-1

The error is not systematic and depend on the robospice service : if the service is completed when onDestroy is called => no crash, if the service is still running => crash.

I'm not 100% that the crash is due to Robospice, but I do not use notification manager in my code, and it always crash when leaving the app with service un background.

Here is the full error in logcat : E/UncaughtException: android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=-2 contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Thanks for your help.

shanuka commented 6 years ago

i got this isse because of the firebase. disable firebase check again

MS893 commented 6 years ago

Thanks for your answer, but I want to use Firebase ! is there a solution to enable Firebase after ?

For the moment, I found a solution : I use API 26 target instead of API 27. But I think it is provisional...

shanuka commented 6 years ago

which servces you may use in your project.

MS893 commented 6 years ago

I use crash reporting and notifications, but I can remove notifications, it's not essential...

shanuka commented 6 years ago

crash reporting working fine with 27. i dont know about notifications. i had trouble with Performance.

shanuka commented 6 years ago

i thought performance services still in beta if i found soution ill let you know 🙂

MS893 commented 6 years ago

OK thanks !

tyates commented 6 years ago

Did anyone find any solution for this?