1. Download the free trial version

MsgBox2 causes android.util.AndroidRuntimeException

Discussion in 'Questions' started by thedesolatesoul, May 7, 2012.

  1. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Some of my code runs fine on a Froyo Emulator, but on ICS 4.0.4 (CM9 Nightly) I get the following exception.

    From what I have read so far it seems that the same message is being posted twice in the message queue.

    As download/upload transfers are happening in the background (with a possible timer running too), I show a messagebox to confirm deleting download history. At that point this exception is generated:
    Code:
    android.util.AndroidRuntimeException: { what=0 when=-12h1m24s814ms } This message is already in use.
       at android.os.MessageQueue.enqueueMessage(MessageQueue.java:
    187)
       at android.os.Handler.sendMessageAtTime(Handler.java:
    473)
       at android.os.Handler.sendMessageDelayed(Handler.java:
    446)
       at android.os.Handler.sendMessage(Handler.java:
    383)
       at anywheresoftware.b4a.Msgbox.waitForMessage(
    Msgbox.java:172)
       at anywheresoftware.b4a.Msgbox.msgbox(
    Msgbox.java:127)
       at anywheresoftware.b4a.keywords.Common.Msgbox2(Common.java:
    404)
       at com.maximus.dropboxexample.main._clearalltransfers(main.java:
    1286)
       at com.maximus.dropboxexample.main._ab_itemclicked(main.java:
    328)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:
    511)
       at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    105)
       at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    93)
       at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    89)
       at de.amberhome.SimpleActionBar.ActionBar$Action.select(ActionBar.java:
    1683)
       at de.amberhome.SimpleActionBar.ActionBar$
    2.onClick(ActionBar.java:262)
       at android.view.View.performClick(
    View.java:3511)
       at android.view.View$PerformClick.run(
    View.java:14105)
       at android.os.Handler.handleCallback(Handler.java:
    605)
       at android.os.Handler.dispatchMessage(Handler.java:
    92)
       at android.os.Looper.loop(Looper.java:
    137)
       at android.app.ActivityThread.main(ActivityThread.java:
    4424)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:
    511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
    787)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    554)
       at dalvik.system.NativeStart.main(Native Method)
    Later on I also get this one, but I think its harmless:
    Code:
    libcore.io.ErrnoException: kill failed: ESRCH (No such process)
       at libcore.io.Posix.kill(Native Method)
       at libcore.io.ForwardingOs.kill(ForwardingOs.java:
    77)
       at java.lang.ProcessManager$ProcessImpl.destroy(ProcessManager.java:
    257)
       at anywheresoftware.b4a.phone.Phone$
    LogCat.LogCatStop(Phone.java:758)
       at anywheresoftware.b4a.b4abridge.service1._stoplogcat(service1.java:
    510)
       at anywheresoftware.b4a.b4abridge.service1._streams_newdata(service1.java:
    565)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:
    511)
       at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    136)
       at anywheresoftware.b4a.BA$
    2.run(BA.java:244)
       at android.os.Handler.handleCallback(Handler.java:
    605)
       at android.os.Handler.dispatchMessage(Handler.java:
    92)
       at android.os.Looper.loop(Looper.java:
    137)
       at android.app.ActivityThread.main(ActivityThread.java:
    4424)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:
    511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
    787)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    554)
       at dalvik.system.NativeStart.main(Native Method)
  2. margret

    margret Well-Known Member Licensed User

    I am running ICS 4.0.3 and do not see this error with the msgbox2(). I know this does not help but wanted to give you feedback from my end.
  3. Erel

    Erel Administrator Staff Member Licensed User

    Android 4.0.3 changes the way that internal messages are handled. I'm familiar with a different issue which is probably related to this one.
    The fix might require a library update.

    Can you create a small project that demonstrates this issue?
    It should be something simple with a msgbox shown inside the ActionBar click event.
  4. corwin42

    corwin42 Well-Known Member Licensed User

    I think in the german forum someone posted a similar problem. See here
  5. Erel

    Erel Administrator Staff Member Licensed User

    It is indeed related. However I want to make sure that this issue is the same. So a test project will still be useful.

    The fix will require an update to existing libraries. However the update should be simple.
  6. thedesolatesoul

    thedesolatesoul Expert Licensed User

    It took me a while to reproduce this. Nothing to do with the action bar.
    It actually crashes with HttpUtils.
    Here is a small example that crashes on ICS for me.
    Press the 'Start Timer' button, and then immediately press ''Show Messagebox'.
    The unfiltered logs will show the exception.

    Also, Erel I am using B4A 1.6 (Core library version 1.57)

    Test Device: ICS 4.0.4 (CM9 Nightly) on a Samsung Galaxy S

    For now, I am thinking of a non-modal messagebox as a workaround, which raises an event on dismissal.
  7. Erel

    Erel Administrator Staff Member Licensed User

    I'm unable to reproduce it. I've tested it with the emulator (which did reproduce the other 4.0.3 related issues). Can other members please test this?
  8. Ricky D

    Ricky D Active Member Licensed User

    Erel, I'm running android 4.0.3 and b4a 1.8.

    What do I need to do to test this?

    Regards, Ricky
  9. Erel

    Erel Administrator Staff Member Licensed User

    Download the example, press on the Timer button and then on the second button.
  10. Ricky D

    Ricky D Active Member Licensed User

    I'll do that when I get home after work
  11. agraham

    agraham Expert Licensed User

    I also cannot reproduce this on B4A 1.9 and Android 4.0.4 on a Motorola Xoom (yes Erel, I did check that I was using the 1.9 jars and that my simple test still crashed). Maybe it's because you are using B4A 1.6 instead of the latest 1.9
  12. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Hi Andrew,
    I dont completely understand what you are saying. Are you saying it crashes on on B4A 1.6 and not 1.9 (regardless of the jar files)?
    Maybe Erel knows if the Msgbox handling changed during these versions.
  13. agraham

    agraham Expert Licensed User

    The information in brackets was for Erel to confirm to him that I was using the original 1.9 jars and not the modified ones that he sent me to test that hopefully solve the problem.
  14. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Okay thanks.
    In hindsight, I see I didnt upload a very good example because it requires you to press the second button very quickly after the first one. (The first button kicks off a couple of downloads, and getting the messagebox in between, stalling the hc_Response messages makes the problem happen).
    Maybe I should have added a timer on the first button for the Msgbox.
    I will try to update the example again later today, if there are no other updates regarding the issue.
  15. Erel

    Erel Administrator Staff Member Licensed User

    See the private message I sent you.
  16. Erel

    Erel Administrator Staff Member Licensed User

    thedesolatesoul has tested it with v1.9 and the error didn't happen.
  17. Merlot2309

    Merlot2309 Active Member Licensed User

    Hello,

    Picked up an old project and the MsgBox2 crashes on my 4.0.3 device.
    No problem on my old 2.2 device.
    See the included test.

    Thanks in advance,
    Helen.

    Attached Files:

  18. Erel

    Erel Administrator Staff Member Licensed User

    Currently there is one known issue with ListView_ItemClick and modal dialogs. The workaround is to call CallSubDelayed from this sub to another sub which will show the dialog. This will be fixed in the next update.
  19. Merlot2309

    Merlot2309 Active Member Licensed User

    Ok, thank you Erel.
  20. RadCoder

    RadCoder Member Licensed User

    I seem to have a similiar problem on my SIII running 4.0.4

    I have datacontroller class using httputils2 to fectch a bunch of data, then the controller class notifies the main activity when data is ready and the main activity updates the UI. Everything works fine on Jellybean , froyo and gingerbread. On my siii running ICS , google maps keeps crashing? Im not using any location based api's. The unfiltered logs show the following

    libcore.io.ErrnoException: kill failed: ESRCH (No such process)
    at libcore.io.Posix.kill(Native Method)
    at libcore.io.ForwardingOs.kill(ForwardingOs.java:77)
    at java.lang.ProcessManager$ProcessImpl.destroy(ProcessManager.java:257)
    at anywheresoftware.b4a.phone.Phone$LogCat.LogCatStop(Phone.java:758)
    at anywheresoftware.b4a.phone.Phone$LogCat.LogCatStart(Phone.java:703)
    at anywheresoftware.b4a.b4abridge.service1._startlogcat(service1.java:614)
    at anywheresoftware.b4a.b4abridge.service1._streams_newdata(service1.java:678)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
    at anywheresoftware.b4a.BA$3.run(BA.java:301)
    at android.os.Handler.handleCallback(Handler.java:605)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4517)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
    at dalvik.system.NativeStart.main(Native Method)
    getActualApplicationStateEnabled() : true
    Failed to destroy process 6300
    libcore.io.ErrnoException: kill failed: ESRCH (No such process)
    at libcore.io.Posix.kill(Native Method)
    at libcore.io.ForwardingOs.kill(ForwardingOs.java:77)
    at java.lang.ProcessManager$ProcessImpl.destroy(ProcessManager.java:257)
    at anywheresoftware.b4a.phone.Phone$LogCat$1.run(Phone.java:741)


    The shortly after the maps force close pops up while in my app, and it keep popping up... which is absolutely baffling

    FATAL EXCEPTION: NetworkLocationCallbackRunner
    java.lang.NullPointerException
    at com.google.googlenav.common.io.protocol.ProtoBuf.getInt(SourceFile:228)
    at com.google.android.location.e.e.b(SourceFile:196)
    at com.google.android.location.b.f.a(SourceFile:395)
    at com.google.android.location.b.b.a(SourceFile:167)
    at com.google.android.location.p.d(SourceFile:268)
    at com.google.android.location.os.real.c$c.handleMessage(SourceFile:358)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at com.google.android.location.os.real.c$f.run(SourceFile:822)
    at java.lang.Thread.run(Thread.java:856)

Share This Page

Loading...