Android Question [SOLVED] Problem when try to start a service and the app was closed

Discussion in 'Android Questions' started by Angel Mauro Avellaneda B., Apr 4, 2015.

  1. Angel Mauro Avellaneda B.

    Angel Mauro Avellaneda B. New Member Licensed User

    I have this error when try to start a service:
    java.lang.RuntimeException: Unable to create service unad.unagenda.
    srvunagendaalarma: 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 unad.unagenda.srvunagendaalarma.onCreate(srvunagendaalarma.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 unad.unagenda.srvunagendaalarma.onCreate(srvunagendaalarma.java:31)
    ... 11 more
    Caused by: java.lang.RuntimeException: java.lang.NullPointerException
    at unad.unagenda.main.initializeProcessGlobals(main.java:603)
    ... 14 more
    Caused by: java.lang.NullPointerException
    at anywheresoftware.b4a.BA.<init>(BA.java:106)
    at unad.unagenda.clsdbadunad.innerInitialize(clsdbadunad.java:12)
    at unad.unagenda.clsdbadunad._initialize(clsdbadunad.java:129)
    at unad.unagenda.main._process_globals(main.java:930)
    at unad.unagenda.main.initializeProcessGlobals(main.java:590)
    ... 14 more
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Are you testing it in release mode?
     
  3. Angel Mauro Avellaneda B.

    Angel Mauro Avellaneda B. New Member Licensed User

    Of course, the app was published... the problem is only when it was closed by user. otherwise it all ok. I tested with other explamples and the problem persist, if i closed an app and it have a service programed when the service try to start show a message the app xxx was stopped.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You should initialize anything from process_globals.

    You should not initialize anything from process_globals.
     
    Last edited: Apr 7, 2015
  5. Angel Mauro Avellaneda B.

    Angel Mauro Avellaneda B. New Member Licensed User

    It's Work fine... I initialize some timer and it's work, thanks. :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice