Crittercism shows how poor Corona for Android is. Coronalabs, do you care?

Regarding the NullPointerExceptions within the CoronaActivity (ie: key/touch events), we added additional error handling and null checks to prevent those exceptions from handling. This change will make it into daily build #1009, tomorrow.

That said, I’m surprised these exceptions are happening at all. The only way they can happen is if the CoronaActivity received key/touch events *after* the window was destroyed via a call to its onDestroy() method by the operating system. But in any case, it doesn’t hurt to have additional error handling on our end. If you can reproduce these NullPointerExceptions on your end, then please let us know if this fixed the issue. Thanks! [import]uid: 32256 topic_id: 35144 reply_id: 139837[/import]

@Joshua: i have been reported the onKeyDown error too, but I couldnt reproduce it so far.

i did a build with 1030 and i now get random crashes (never had them before):

Process com.digidingo.samsung.grooh (pid 21355) has died. 02-15 16:23:12.545 E/InputDispatcher( 2695): channel '40576250 com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8 02-15 16:23:12.545 E/InputDispatcher( 2695): channel '40576250 com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 02-15 16:23:12.545 I/WindowManager( 2695): WIN DEATH: Window{40576250 com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity paused=false} 02-15 16:23:12.550 W/SurfaceFlinger( 2695): com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity[34016] is not removed from mLayerMap 02-15 16:23:12.550 W/WindowManager( 2695): Window Window{40576250 com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity paused=false} destroyed surface Surface(name=com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity, identity=-1, mNativeSurface=0), session Session{40714288 uid 10131} 02-15 16:23:12.550

any idea? could the explicit call of the collectgarbage(“collect”) cause any trouble?

thanks! [import]uid: 90610 topic_id: 35144 reply_id: 142876[/import]

dingo, your error is unrelated to the errors brought up on this forum thread.

As of daily build #1030, and by popular demand, we removed permissions INTERNET, READ_PHONE_STATE, and ACCESS_NETWORK_STATE from all Android builds. You now must opt-in to using them via your “build.settings” file.
https://developer.coronalabs.com/release/2013/1030

If your app is trying to use the network without the Android INTERNET permission, then that will now cause Android to throw an INTERNET permission exception, which Corona catches and turns into a Lua error. This is by design. This error will then be displayed to you on screen with the Java exception message and/or the Lua runtime error (with a Lua stack trace for debug builds), telling you exactly what went wrong so that you can fix it on your end. This error also gets outputted to the Android log.

So, bottom line, you need to add the following permission to your “build.settings” file…
[lua]
settings =
{
android =
{
usesPermissions =
{
“android.permission.INTERNET”,
}
}
}
[/lua]

Please have a look at the newest API documentation available on our daily build page. We’ve updated about 2 weeks ago to indicate which APIs require the above permissions. We’ve also updated all of the sample projects included with the newest version of the Corona SDK to include the above permissions when needed. [import]uid: 32256 topic_id: 35144 reply_id: 142914[/import]

Joshua, we’re still waiting for some feedback in the thread about remote notification exceptions on Android (android.app.RemoteServiceException: Bad notification posted from package).

We are logging all exceptions from Androids to Crittercism. Why aren’t you guys interested in digging into it? I mean, if I were you I would have asked for access to the site to start digging into all the exceptions and make the product you deliver robust and stable. Weird.

Anyway, we have this one happening for our users hundreds of times per day as well:

0
java.lang.IndexOutOfBoundsException: getChars (0 … 11) ends beyond length 10
1
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:943)
2
at android.text.SpannableStringBuilder.getChars(SpannableStringBuilder.java:847)
3
at android.text.SpannableStringBuilder.toString(SpannableStringBuilder.java:869)
4
at com.ansca.corona.ViewManager.getTextViewText(ViewManager.java:512)
5
at com.ansca.corona.NativeToJavaBridge.callTextFieldGetText(NativeToJavaBridge.java:1782)
6
at com.ansca.corona.JavaToNativeShim.nativeTextEditingEvent(Native Method)
7
at com.ansca.corona.JavaToNativeShim.textEditingEvent(JavaToNativeShim.java:272)
8
at com.ansca.corona.events.TextEditingEvent.Send(TextEditingEvent.java:29)
9
at com.ansca.corona.events.EventManager.sendEvents(EventManager.java:274)
10
at com.ansca.corona.Controller.onDrawFrame(Controller.java:229)
11
at com.ansca.corona.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:302)
12
at com.ansca.corona.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1622)
13
at com.ansca.corona.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377) [import]uid: 21746 topic_id: 35144 reply_id: 142918[/import]

Haakon,

I was just waiting to receive a stack trace from you. I didn’t realize you were waiting on me as well. Sorry about that.

The stack trace that you’ve posted up above is a big help. It indicates a threading issue with fetching text from a TextField/TextBox in Lua while the user is deleting text by pressing the backspace key. I can look into fixing this issue next week.

Regarding the RemoteServiceException, I’m talking to kimruben about it on the forum thread link below. We’re not able to reproduce this issue, nor do we have enough information to know what exactly is the problem yet. I’m currently waiting for a response from him so that we can isolate it further. Particularly if these errors are coming from a specific device.
http://developer.coronalabs.com/forum/2013/02/04/android-exceptions
[import]uid: 32256 topic_id: 35144 reply_id: 142971[/import]

thanks joshua. i still get that crash.

another question: when i install the app, it asks about the READ_PHONE_STATE permission, even though i have not put it in the build file. has that something to do with the launchpad? [import]uid: 90610 topic_id: 35144 reply_id: 143186[/import]

dingo,

This means that your app is using a feature that requires the READ_PHONE_STATE permission. In fact, if you build your app with the “debug.keystore”, then the error message you see onscreen will tell you which Lua file and line number is causing this permission error, which is a new feature to make it easier to debug issues.

If your app uses “inneractive” or “InMobi” ads, then you need to add the following permissions to your “build.settings” file now.

  • INTERNET
  • READ_PHONE_STATE
  • ACCESS_NETWORK_STATE

Have a look at the “build.settings” file in sample project “ads/InMobi” for an example on how to add these permissions to your file… assuming that you are using ads of course. [import]uid: 32256 topic_id: 35144 reply_id: 143544[/import]

@Joshua: i have been reported the onKeyDown error too, but I couldnt reproduce it so far.

i did a build with 1030 and i now get random crashes (never had them before):

Process com.digidingo.samsung.grooh (pid 21355) has died. 02-15 16:23:12.545 E/InputDispatcher( 2695): channel '40576250 com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8 02-15 16:23:12.545 E/InputDispatcher( 2695): channel '40576250 com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 02-15 16:23:12.545 I/WindowManager( 2695): WIN DEATH: Window{40576250 com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity paused=false} 02-15 16:23:12.550 W/SurfaceFlinger( 2695): com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity[34016] is not removed from mLayerMap 02-15 16:23:12.550 W/WindowManager( 2695): Window Window{40576250 com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity paused=false} destroyed surface Surface(name=com.digidingo.samsung.grooh/com.ansca.corona.CoronaActivity, identity=-1, mNativeSurface=0), session Session{40714288 uid 10131} 02-15 16:23:12.550

any idea? could the explicit call of the collectgarbage(“collect”) cause any trouble?

thanks! [import]uid: 90610 topic_id: 35144 reply_id: 142876[/import]

dingo, your error is unrelated to the errors brought up on this forum thread.

As of daily build #1030, and by popular demand, we removed permissions INTERNET, READ_PHONE_STATE, and ACCESS_NETWORK_STATE from all Android builds. You now must opt-in to using them via your “build.settings” file.
https://developer.coronalabs.com/release/2013/1030

If your app is trying to use the network without the Android INTERNET permission, then that will now cause Android to throw an INTERNET permission exception, which Corona catches and turns into a Lua error. This is by design. This error will then be displayed to you on screen with the Java exception message and/or the Lua runtime error (with a Lua stack trace for debug builds), telling you exactly what went wrong so that you can fix it on your end. This error also gets outputted to the Android log.

So, bottom line, you need to add the following permission to your “build.settings” file…
[lua]
settings =
{
android =
{
usesPermissions =
{
“android.permission.INTERNET”,
}
}
}
[/lua]

Please have a look at the newest API documentation available on our daily build page. We’ve updated about 2 weeks ago to indicate which APIs require the above permissions. We’ve also updated all of the sample projects included with the newest version of the Corona SDK to include the above permissions when needed. [import]uid: 32256 topic_id: 35144 reply_id: 142914[/import]

Joshua, we’re still waiting for some feedback in the thread about remote notification exceptions on Android (android.app.RemoteServiceException: Bad notification posted from package).

We are logging all exceptions from Androids to Crittercism. Why aren’t you guys interested in digging into it? I mean, if I were you I would have asked for access to the site to start digging into all the exceptions and make the product you deliver robust and stable. Weird.

Anyway, we have this one happening for our users hundreds of times per day as well:

0
java.lang.IndexOutOfBoundsException: getChars (0 … 11) ends beyond length 10
1
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:943)
2
at android.text.SpannableStringBuilder.getChars(SpannableStringBuilder.java:847)
3
at android.text.SpannableStringBuilder.toString(SpannableStringBuilder.java:869)
4
at com.ansca.corona.ViewManager.getTextViewText(ViewManager.java:512)
5
at com.ansca.corona.NativeToJavaBridge.callTextFieldGetText(NativeToJavaBridge.java:1782)
6
at com.ansca.corona.JavaToNativeShim.nativeTextEditingEvent(Native Method)
7
at com.ansca.corona.JavaToNativeShim.textEditingEvent(JavaToNativeShim.java:272)
8
at com.ansca.corona.events.TextEditingEvent.Send(TextEditingEvent.java:29)
9
at com.ansca.corona.events.EventManager.sendEvents(EventManager.java:274)
10
at com.ansca.corona.Controller.onDrawFrame(Controller.java:229)
11
at com.ansca.corona.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:302)
12
at com.ansca.corona.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1622)
13
at com.ansca.corona.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377) [import]uid: 21746 topic_id: 35144 reply_id: 142918[/import]

Haakon,

I was just waiting to receive a stack trace from you. I didn’t realize you were waiting on me as well. Sorry about that.

The stack trace that you’ve posted up above is a big help. It indicates a threading issue with fetching text from a TextField/TextBox in Lua while the user is deleting text by pressing the backspace key. I can look into fixing this issue next week.

Regarding the RemoteServiceException, I’m talking to kimruben about it on the forum thread link below. We’re not able to reproduce this issue, nor do we have enough information to know what exactly is the problem yet. I’m currently waiting for a response from him so that we can isolate it further. Particularly if these errors are coming from a specific device.
http://developer.coronalabs.com/forum/2013/02/04/android-exceptions
[import]uid: 32256 topic_id: 35144 reply_id: 142971[/import]

Haakon,

The TextField/TextBox exception that you last posted should now be fixed. Note that I was not able to reproduce this issue for myself, but I saw the multithreaded race condition in our code (thanks to your stack trace) and fixed it. I’m confident that this code change will resolve the issue. This fix will be made available in daily build #1035.

If you have any other stack traces that you want to share with me, then please feel free to send them my way. [import]uid: 32256 topic_id: 35144 reply_id: 143856[/import]

Looks like most of the remaining exceptions we have to deal with now is with 3rd party SDKs. However, there are still 1 BIG exception group in Crittercism that we can’t trace back to a plugin, which means it’s a possible Corona-bug:

0 java.lang.IllegalArgumentException: View not attached to window manager  
1 at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:587)  
2 at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:324)  
3 at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:151)  
4 at android.app.Dialog.dismissDialog(Dialog.java:321)  
5 at android.app.Dialog$1.run(Dialog.java:119)  
6 at android.os.Handler.handleCallback(Handler.java:605)  
7 at android.os.Handler.dispatchMessage(Handler.java:92)  
8 at android.os.Looper.loop(Looper.java:137)  
9 at android.app.ActivityThread.main(ActivityThread.java:4441)  
10 at java.lang.reflect.Method.invokeNative(Native Method)  
11 at java.lang.reflect.Method.invoke(Method.java:511)  
12 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)  
13 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)  
14 at dalvik.system.NativeStart.main(Native Method)  

[import]uid: 21746 topic_id: 35144 reply_id: 143884[/import]

thanks joshua. i still get that crash.

another question: when i install the app, it asks about the READ_PHONE_STATE permission, even though i have not put it in the build file. has that something to do with the launchpad? [import]uid: 90610 topic_id: 35144 reply_id: 143186[/import]

thanks joshua. i am not using any ads etc.

i think its an audio related issue:

D/AudioPolicyManager( 2587): Now, There is no sound! so we check mAvailableOutputDevices variable 02-25 09:47:39.535 D/AudioPolicyManager( 2587): HPH volume levels.... =\> music\_hph 12, radio\_hph 0, tts\_hph 12 02-25 09:47:39.535 D/AudioPolicyManager( 2587): SPK volume levels.... =\> music 0, radio 0, tts 0 02-25 09:47:39.535 D/AudioPolicyManager( 2587): mCurDevice is 0 02-25 09:47:39.535 D/AudioPolicyManager( 2587): Now, There is no sound! so we check mAvailableOutputDevices variable 02-25 09:47:39.535 D/AudioPolicyManager( 2587):   

[import]uid: 90610 topic_id: 35144 reply_id: 144113[/import]

Just IMHO…

It appears that CoronaLabs /do/ care about their SDK’s performance on Android. It also appears that even when bug reports are not filed, they pay attention. I would still urge that bug reports get filed and that they are as correct and fully-informing as possible.

I also think that the natural state of any multi-platform SDK would be more slanted towards iOS because iOS is not fractured as a platform, whereas it is widely accepted that Android is pretty much fractured to the point of being broken. Corona, Google and many others have commented and documented this fact time and again.

Not wishing to turn this fairly productive thread into a flame war, but I do feel that accusing anyone of not caring about their product is best placed elsewhere. Corona Labs, imho, do care but are still just people. [import]uid: 8271 topic_id: 35144 reply_id: 144120[/import]

Haakon,

I can reproduce the exception that you’ve posted by displaying an alert dialog or activity indicator and then quickly backing out of the app just before that dialog gets displayed. It causes a silent exception in the log (no error is displayed onscreen), but Android still force quits the app causing any notifications that you might have in the status bar to disappear with it. You can reproduce this issue via sample app “Interface/MapView”, tap the app’s “Current Location” button, and then quickly back out of the app. If you’re fast enough, then you’ll see this exception in the log.
(Assuming this is the same error you are encountering.)

We’ve modified Corona to close its dialogs just before exiting the app, preventing this crash from happening. This change will be made available in daily build #1037.

Also, please note if you are displaying any dialogs via native code (ie: not via Corona’s APIs), then you’ll need to close them during the applicationExit event or else you’ll run into a similar crash as well. This is because Android does not automatically dismiss an Activity’s dialogs while it is being destroyed.

I hope this helps. [import]uid: 32256 topic_id: 35144 reply_id: 144354[/import]

Dingo,

I think those audio messages in your log are just warnings.

If you’re still seeing permission errors, then you’re using a feature that requires the permission being displayed on screen. The full Java exception stack trace will be printed to the Android log, indicating which Android feature you are using that requires said permission. Would you mind posting the full stack trace here? Then I can point out what the root cause is. [import]uid: 32256 topic_id: 35144 reply_id: 144357[/import]

dingo,

This means that your app is using a feature that requires the READ_PHONE_STATE permission. In fact, if you build your app with the “debug.keystore”, then the error message you see onscreen will tell you which Lua file and line number is causing this permission error, which is a new feature to make it easier to debug issues.

If your app uses “inneractive” or “InMobi” ads, then you need to add the following permissions to your “build.settings” file now.

  • INTERNET
  • READ_PHONE_STATE
  • ACCESS_NETWORK_STATE

Have a look at the “build.settings” file in sample project “ads/InMobi” for an example on how to add these permissions to your file… assuming that you are using ads of course. [import]uid: 32256 topic_id: 35144 reply_id: 143544[/import]

Perfect Joshua, it’s getting better and better. [import]uid: 21746 topic_id: 35144 reply_id: 144388[/import]