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.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero #430

Open kjjgibson opened 9 years ago

kjjgibson commented 9 years ago

When running my tests occasionally I get this exception:

FATAL EXCEPTION: main
    Process: com.moroku.clientlibrary.test, PID: 5877
    android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1466)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5254)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

I think the issue is coming from Robospice but it only seems to happen about 1 in every 5/6 times. I'm running on a Nexus 5 which is running Android 5.1.1.

softwaremaverick commented 9 years ago

This could be related to the hack done to not require an icon when it runs in the background. Try setting an application icon for the notification and see if that works

On 29 July 2015 08:24:16 GMT+01:00, Kenneth Gibson notifications@github.com wrote:

When running my tests occasionally I get this exception:

FATAL EXCEPTION: main
   Process: com.moroku.clientlibrary.test, PID: 5877
android.app.RemoteServiceException: Bad notification for
startForeground: java.lang.RuntimeException: icon must be non-zero
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1466)
           at android.os.Handler.dispatchMessage(Handler.java:102)
           at android.os.Looper.loop(Looper.java:135)
          at android.app.ActivityThread.main(ActivityThread.java:5254)
           at java.lang.reflect.Method.invoke(Native Method)
           at java.lang.reflect.Method.invoke(Method.java:372)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

I think the issue is coming from Robospice but it only seems to happen about 1 in every 5/6 times. I'm running on a Nexus 5 which is running Android 5.1.1.


Reply to this email directly or view it on GitHub: https://github.com/stephanenicolas/robospice/issues/430

Sent from my Android device with K-9 Mail. Please excuse my brevity.

kjjgibson commented 9 years ago

Thanks for the quick response.

I set the app icon and this fixes the problem.

The project is actually a library project which is why it didn't have an icon to begin with. However the library project cannot have an app icon as this conflicts with the actual apps icon and I get a manifest merger failed error. In case anyone else sees this then I've fixed this problem by referring to this: link

stephanenicolas commented 9 years ago

Nice workaround !

2015-07-29 17:22 GMT-07:00 Kenneth Gibson notifications@github.com:

Thanks for the quick response.

I set the app icon and this fixes the problem.

The project is actually a library project which is why it didn't have an icon to begin with. However the library project cannot have an app icon as this conflicts with the actual apps icon and I get a manifest merger failed error. In case anyone else sees this then I've fixed this problem by referring to this: link http://stackoverflow.com/questions/24506800/android-studio-gradle-icon-error-manifest-merger

— Reply to this email directly or view it on GitHub https://github.com/stephanenicolas/robospice/issues/430#issuecomment-126134819 .