Android Exceptions

Hi

Just wondering if you have any insight on these common crashes?
These are caught relatively often, but isn’t something that happens to every Android user.

Stack Trace
_________________________________
0 android.app.RemoteServiceException: Bad notification posted from package no.monkeybin.mindfeud: Couldn’t expand RemoteViews for: StatusBarNotification(pkg=no.monkeybin.mindfeud id=32 tag=null score=0 notn=Notification(pri=0 contentView=no.monkeybin.mindfeud/0x109008e vibrate=null sound=content://no.monkeybin.mindfeud.files/assets/notification.wav defaults=0x0 flags=0x18 kind=[null]) user=UserHandle{0})
1 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1411)
2 at android.os.Handler.dispatchMessage(Handler.java:99)
3 at android.os.Looper.loop(Looper.java:137)
4 at android.app.ActivityThread.main(ActivityThread.java:5191)
5 at java.lang.reflect.Method.invokeNative(Native Method)
6 at java.lang.reflect.Method.invoke(Method.java:511)
7 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
8 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
9 at dalvik.system.NativeStart.main(Native Method)

And this one:
Stack Trace
_________________________________
0 android.app.RemoteServiceException: Bad notification posted from package no.monkeybin.mindfeud: Couldn’t create icon: StatusBarIcon(pkg=no.monkeybin.mindfeud id=0x7f020001 level=0 visible=true num=0 )
1 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271)
2 at android.os.Handler.dispatchMessage(Handler.java:99)
3 at android.os.Looper.loop(Looper.java:137)
4 at android.app.ActivityThread.main(ActivityThread.java:4511)
5 at java.lang.reflect.Method.invokeNative(Native Method)
6 at java.lang.reflect.Method.invoke(Method.java:511)
7 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
8 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
9 at dalvik.system.NativeStart.main(Native Method)

[import]uid: 63706 topic_id: 35601 reply_id: 335601[/import]

I’ve never seen Corona cause this error before.

Are you posting a Notification object in Java yourself? Because I believe this error occurs if you attempt to post a misconfigured Notification object to the NotificationManager. You are supposed to use the “Notification.Builder” class to create Notification objects when running on Android 3.0 or higher. [import]uid: 32256 topic_id: 35601 reply_id: 141742[/import]

Hi

No, we’re not posting anything ourselves.
We found that others(non corona) have similar issues on 2.3.

So, please look into this on your side…
[import]uid: 63706 topic_id: 35601 reply_id: 142290[/import]

I’ve never seen Corona cause this error before.

Are you posting a Notification object in Java yourself? Because I believe this error occurs if you attempt to post a misconfigured Notification object to the NotificationManager. You are supposed to use the “Notification.Builder” class to create Notification objects when running on Android 3.0 or higher. [import]uid: 32256 topic_id: 35601 reply_id: 141742[/import]

So far, we can’t reproduce this issue. And those stackoverflow posts are not applicable since we do not use remote views. The stack traces that you’ve posted above do not have anything Corona related in them. So, the exception is not coming from Corona’s code. It looks like the exception is happening on app startup and it looks like it has something to do with your notification wav file.

I’m guessing that your wav file plays correctly for you, right?

I tried adding an status bar notification with a custom wav file and then moving the app to the SD card (and vice-versa) in case it was a file lookup issue, but it still played the notification wav file correctly. And it should too because we use that [lua]“com.ansca.corona.FileContentProvider”[/lua] that you can see in our AndroidManifest.xml file which provides access to that wav file via a URL using the app’s unique package name. We put a lot of thought into the design of this to make it work reliably.

Are you able to reproduce this issue on any of your devices?

Also, can you also tell us which Android devices and Android OS versions these crashes came from?
(Just in case this is a device specific issue.)
[import]uid: 32256 topic_id: 35601 reply_id: 142671[/import]

Hi

We’re not able to reproduce this ourselves.
And yes, everything works just fine on all our devices.

As far as I can see in Crittercism, it happens for the most part on Honeycomb, ICS and JB and all api levels for those Android versions.

I picked one error group for a device stat:(Group had 51 error instances)
46 of them was GT-I9100
2 was GT-N7000
1 was GT-I9100G
1 was Alcatel_on_touch_995
1 was Nexus S

Let me know if you want to dig around in all these stats for the various stack traces we are seeing.

Kim Ruben [import]uid: 63706 topic_id: 35601 reply_id: 143000[/import]

Hi

No, we’re not posting anything ourselves.
We found that others(non corona) have similar issues on 2.3.

So, please look into this on your side…
[import]uid: 63706 topic_id: 35601 reply_id: 142290[/import]

We just published an update on Google Play, and have a new stack trace that we haven’t had before.
The latest live version was built using 1031.

  
Stack Trace  
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
0 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { dat=content://com.google.android.gallery3d.provider/picasa/item/5785803843059147810 }} to activity {no.monkeybin.mindfeud/com.ansca.corona.CoronaActivity}: java.lang.NullPointerException: println needs a message  
1 at android.app.ActivityThread.deliverResults(ActivityThread.java:3141)  
2 at android.app.ActivityThread.handleSendResult(ActivityThread.java:3184)  
3 at android.app.ActivityThread.access$1100(ActivityThread.java:130)  
4 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)  
5 at android.os.Handler.dispatchMessage(Handler.java:99)  
6 at android.os.Looper.loop(Looper.java:137)  
7 at android.app.ActivityThread.main(ActivityThread.java:4745)  
8 at java.lang.reflect.Method.invokeNative(Native Method)  
9 at java.lang.reflect.Method.invoke(Method.java:511)  
10 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)  
11 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)  
12 at dalvik.system.NativeStart.main(Native Method)  
13 Caused by: java.lang.NullPointerException: println needs a message  
14 at android.util.Log.println\_native(Native Method)  
15 at android.util.Log.d(Log.java:138)  
16 at com.ansca.corona.CoronaActivity.onActivityResult(CoronaActivity.java:1225)  
17 at android.app.Activity.dispatchActivityResult(Activity.java:5192)  
18 at android.app.ActivityThread.deliverResults(ActivityThread.java:3137)  
19 ... 11 more  
20 java.lang.NullPointerException: println needs a message  
21 at android.util.Log.println\_native(Native Method)  
22 at android.util.Log.d(Log.java:138)  
23 at com.ansca.corona.CoronaActivity.onActivityResult(CoronaActivity.java:1225)  
24 at android.app.Activity.dispatchActivityResult(Activity.java:5192)  
25 at android.app.ActivityThread.deliverResults(ActivityThread.java:3137)  
26 at android.app.ActivityThread.handleSendResult(ActivityThread.java:3184)  
27 at android.app.ActivityThread.access$1100(ActivityThread.java:130)  
28 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)  
29 at android.os.Handler.dispatchMessage(Handler.java:99)  
30 at android.os.Looper.loop(Looper.java:137)  
31 at android.app.ActivityThread.main(ActivityThread.java:4745)  
32 at java.lang.reflect.Method.invokeNative(Native Method)  
33 at java.lang.reflect.Method.invoke(Method.java:511)  
34 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)  
35 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)  
36 at dalvik.system.NativeStart.main(Native Method)  
  

I’m gonna take a guess that this is caused by users picking images from picasa albums.
Now, that does not cause any errors on our SIII, but some of the reports come from Nexus 7s.

Why would we see this error now, and not before? [import]uid: 63706 topic_id: 35601 reply_id: 143244[/import]

So far, we can’t reproduce this issue. And those stackoverflow posts are not applicable since we do not use remote views. The stack traces that you’ve posted above do not have anything Corona related in them. So, the exception is not coming from Corona’s code. It looks like the exception is happening on app startup and it looks like it has something to do with your notification wav file.

I’m guessing that your wav file plays correctly for you, right?

I tried adding an status bar notification with a custom wav file and then moving the app to the SD card (and vice-versa) in case it was a file lookup issue, but it still played the notification wav file correctly. And it should too because we use that [lua]“com.ansca.corona.FileContentProvider”[/lua] that you can see in our AndroidManifest.xml file which provides access to that wav file via a URL using the app’s unique package name. We put a lot of thought into the design of this to make it work reliably.

Are you able to reproduce this issue on any of your devices?

Also, can you also tell us which Android devices and Android OS versions these crashes came from?
(Just in case this is a device specific issue.)
[import]uid: 32256 topic_id: 35601 reply_id: 142671[/import]

Any update on this?

Also, is there any reason why you can’t return the urls for network media to the listener?
As the stack traces for picasa media and also google content media shows the urls.

[import]uid: 63706 topic_id: 35601 reply_id: 143515[/import]

Regarding the exception with the PhotoLibrary, we believe that was caused by daily build #1030.
http://developer.coronalabs.com/release/2013/1030/

We were not able to reproduce this issue for ourselves, but we saw the potential error in our code and made a “blind” fix for it. This fix will be made available in daily build #1033, tomorrow.

Also, we do not provide the URL to the file because iOS does not provide an equivalent path (iOS provides the image data instead. This prevents us from providing a cross-platform API for it. So, this is why we’ve set up our media.show() API with the option to save the image as a local file instead, which we can do on both the Android and iOS platforms easily, making it cross-platform. [import]uid: 32256 topic_id: 35601 reply_id: 143542[/import]

Regarding the notification exceptions, I don’t believe that the error about “RemoteViews” is coming from Corona. Corona does not create remote views under the status bar. Nor does Corona ever expand view from XML as the exception message indicates. Since you have Corona Enterprise, if you look under the “android/lib/Corona/res” directory, notice that we have no XML files to expand a view from.

Are you using any 3rd party libraries?
If so, can you tell me which ones you are using?
Because I’m thinking that a 3rd party library is trying to add status bar notification within your app and it may be conflicting with Corona’s status bar notifications. If this is the case, then we can work with you on providing a solution to this. [import]uid: 32256 topic_id: 35601 reply_id: 143543[/import]

Hi Joshua,

I suspect that either Chartboost may be the library that tries to add the status bar notification. Yesterday we submit an update of an old game to Apple, and I got an automated email from iTunesConnect about a “Missing Push Notification Entitlement”. The only plugin in the project is Chartboost.

Btw, when I tried to remove the Facebook SDK and Facebook resources from the iOS project, it would not build as there was a dependency in libplayer.a. Can you get the iOS team to remove that dependency?

One more thing. I implemented the table-fix for image downloads yesterday, and it works fine on iOS. I don’t know about Android yet - Kim is asleep :). But there’s a bug in the simulator you should take a look at. This exception is thrown when you run this piece of code and select an image:

  
media.show(media.PhotoLibrary, function(event)  
 if event and event.completed then  
 display.newImage("image.jpg", system.TemporaryDirectory)  
 end  
end, {baseDir=system.TemporaryDirectory, filename="image.jpg", type="image"})  
  

Throws this exception:

-ImageKit Error: texturePacker: glGetError returned an error before createTexturePackerAtIndex err=1286 (in context: 0x102c7e000)  
2013-02-22 09:48:27.304 Corona Simulator[45626:707] MacImageProvider::Show: got removeItemAtURL error Error Domain=NSCocoaErrorDomain Code=4 "“image.jpg” couldn’t be removed." UserInfo=0x10a9be2e0 {NSFilePath=/Users/Haakon/Library/Application Support/Corona Simulator/Corona-989FFEA0A0056F1363B0E32117AF72FE/tmp/image.jpg, NSUserStringVariant=(  
 Remove  
), NSUnderlyingError=0x10a9c9620 "The operation couldn’t be completed. No such file or directory"}  
2013-02-22 09:48:27.319 Corona Simulator[45626:707] glCheckFramebufferStatus error at end unbindRenderFBO  

[import]uid: 21746 topic_id: 35601 reply_id: 143696[/import]

Hey

So, the optional file param doesn’t seem to work on Android.
It just returns a false for event.completed

media.show(media.PhotoLibrary, function(event)  
 -- We only receive event.completed == false here...  
 if event and event.completed then  
 local image = display.newImage("image.jpg", system.TemporaryDirectory)  
 if image then  
 -- Do something with the image..  
 else  
 -- Fail  
 end  
 end  
end, {baseDir=system.TemporaryDirectory, filename="image.jpg", type="image"})  

Did we get something wrong here?? [import]uid: 63706 topic_id: 35601 reply_id: 143706[/import]

Forgot to mention that this is for images that are not on device.
Try this with picasa, skydrive or dropbox images. [import]uid: 63706 topic_id: 35601 reply_id: 143707[/import]

Hi

We’re not able to reproduce this ourselves.
And yes, everything works just fine on all our devices.

As far as I can see in Crittercism, it happens for the most part on Honeycomb, ICS and JB and all api levels for those Android versions.

I picked one error group for a device stat:(Group had 51 error instances)
46 of them was GT-I9100
2 was GT-N7000
1 was GT-I9100G
1 was Alcatel_on_touch_995
1 was Nexus S

Let me know if you want to dig around in all these stats for the various stack traces we are seeing.

Kim Ruben [import]uid: 63706 topic_id: 35601 reply_id: 143000[/import]

Regarding the status bar notification exception, I think Corona and Chartboost must be using the same status bar notification IDs, causing a conflict. Okay, so this was a good find. I modified Corona’s notification handling by giving Corona’s notifications a unique string tag as well, per the Android documentation link below. That will prevent this from happening in the future.
http://developer.android.com/reference/android/app/NotificationManager.html

We also fixed that Android TextField/TextBox exception that you brought up on your Crittercism forum thread.

Both of the above changes will be made available in daily build #1035. [import]uid: 32256 topic_id: 35601 reply_id: 143845[/import]

Great Joshua, we’ll move to 1035.

What about the external images that cant be used on Android, is that going to be fixed or not? If you’re not going to fix it, you should at least return a reason when event.completed is false. We can write a new media.show plugin that fixes it for us, but the problem affects all Corona built Android apps. [import]uid: 21746 topic_id: 35601 reply_id: 143851[/import]

I’ve just informed the rest of our team about the iOS Facebook SDK reference issue and about the Corona Simulator crashing via media.show() when saving to file. I’ll also make sure to bug them in-person about it during on Monday.

Regarding selecting a photo from a 3rd party app, I just tried it with SkyDrive and noticed that we are not getting a file path from it. It looks like we don’t have direct file access to SkyDrive’s files, which makes sense if they’re in that app’s private files directory instead of external storage, so we’ll have to fetch the photo’s bytes via an Android ContentProvider. I’ll write up a bug report about to get it in our queue.

By the way, which Picasa app are you testing with on Google Play? [import]uid: 32256 topic_id: 35601 reply_id: 143852[/import]

Oh and our media.show() API can successfully save photos on Android from the standard “Gallery” app on all Android devices, include Kindle Fire and Nook. This is just an issue with photo apps that do not share pictures via external storage… or that provide file access via a ContentProvider’s openFile() method. We’ll definitely need to add support for that since you have no control over what the default photo gallery app is on the device. [import]uid: 32256 topic_id: 35601 reply_id: 143853[/import]