I am working on adding a Widget to one of my apps. I followed the tutorial and was able to add the widget and get it working. But if I make any changes to the app and try to reinstall it on my phone, I always get the java.lang.RuntimeException: Unable to create service error. After the error, it appears to go ahead and create the service.
This only happens when I have the widget already on my Home Screen. If I remove the widget and then re-install the app, I do not get the error.
Any suggestions on how to prevent this error from happening? I've tried debugging but it happens before any of my code is run.
This only happens when I have the widget already on my Home Screen. If I remove the widget and then re-install the app, I do not get the error.
B4X:
java.lang.RuntimeException: Unable to create service com.isotoria.turboflash.flashlight: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2595)
at android.app.ActivityThread.access$1800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5097)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.isotoria.turboflash.flashlight.onCreate(flashlight.java:33)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2585)
... 10 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.isotoria.turboflash.flashlight.onCreate(flashlight.java:31)
... 11 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at com.isotoria.turboflash.main.initializeProcessGlobals(main.java:616)
... 14 more
Caused by: java.lang.NullPointerException
at com.isotoria.turboflash.main._process_globals(main.java:756)
at com.isotoria.turboflash.main.initializeProcessGlobals(main.java:607)
... 14 more
** Service (flashlight) Create **
** Service (flashlight) Start **
** Activity (main) Create, isFirst = true **
Any suggestions on how to prevent this error from happening? I've tried debugging but it happens before any of my code is run.