Android Exceptions

Yup, thats right Joshua. The Picasa app we’re testing with is the default one that’s shipped with the Galaxy S3, so I guess it’s Googles app.

Are you able to say anything about when you’ll look at implementing the openFile-implementation? [import]uid: 21746 topic_id: 35601 reply_id: 143881[/import]

Just to clarify here…

When the media.show() is called, I get a dialog with 2 choices…
“DropBox” and “Gallery”

When tapping the Gallery icon, I am presented a “Gallery” with various images.
I don’t use this phone for everyday use, it’s only a test/dev device.
But I have use Google+ and stuff on it.

So what I see is 3 folders that, for me, is intuitively marked as on device folders.
And lots of folders with the small Picasa icon on them, like Instant Uploads etc.
These are images that come from Google+ and various other places. Not taken on this device.

[import]uid: 63706 topic_id: 35601 reply_id: 143885[/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]

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]

That 2 choice Gallery and Drop Box prompt appears to be new. I had to update the OS on my Galaxy SIII today to get it to show me that option. But that said, Corona we’ll need to support it and “keep up” with Android’s changes.

I’m working on the photo selection issue now. I’ve managed to get it to work with Picasa, Drop Box, and local photos from the Gallery app so far. I’ll have to do some more testing tomorrow on several other devices and with Google+ and SkyDrive… but if all goes well, I should have a solution for you guys by the end of this week. [import]uid: 32256 topic_id: 35601 reply_id: 144379[/import]

Excellent news, Joshua! Thank you! :slight_smile: That’s going to help tremendously on the Crittercism exceptions and user tickets for us.

Just discovered one thing yesterday. Remember that I pointed out that there’s a dependency in libplayer.a on Facebook? Theres something equally strange in the Android version. Even though we’re not referencing or using Flurry, Inneractive or Inmobi, dex files are still being created and added to the final build. We’re not fans of adding stuff that’s not in use, it’d be better if you dropped all such dependencies and made it possible for us to add on demand. Is it possible? [import]uid: 21746 topic_id: 35601 reply_id: 144386[/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]

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]

Yup, thats right Joshua. The Picasa app we’re testing with is the default one that’s shipped with the Galaxy S3, so I guess it’s Googles app.

Are you able to say anything about when you’ll look at implementing the openFile-implementation? [import]uid: 21746 topic_id: 35601 reply_id: 143881[/import]

Just to clarify here…

When the media.show() is called, I get a dialog with 2 choices…
“DropBox” and “Gallery”

When tapping the Gallery icon, I am presented a “Gallery” with various images.
I don’t use this phone for everyday use, it’s only a test/dev device.
But I have use Google+ and stuff on it.

So what I see is 3 folders that, for me, is intuitively marked as on device folders.
And lots of folders with the small Picasa icon on them, like Instant Uploads etc.
These are images that come from Google+ and various other places. Not taken on this device.

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

This media.show() issue with remote images is now fixed. Our newest changes can now successfully open images from Picasa, Google+, SkyDrive, and DropBox. This fix will be made available in daily build #1041.

Regarding the Facebook, Flurry, and other libraries that you see within Corona’s dex file, those are just Corona’s thin plugin interfaces to those 3rd party libraries. They won’t do any harm. In fact, they belong to the JAR files that you see in the following directory…
> CoronaEnterprise/Corona/android/lib/Corona/libs

If you don’t like their inclusion at the moment, then you can try removing those JAR files from Corona’s “libs” directory yourself. That will exclude their classes from the final build. I haven’t tested their exclusion from Corona for myself, but I’m pretty sure as long as you never require those features, then they won’t do any harm.

Our plugin support on Android is still very new and being actively worked on, meaning we still have some cleanup to do and we’ll likely make these libraries optional. In fact, our first real guinea pig with an “optional” Android plugin will be the upcoming Green Throttle. So, I would expect some Enterprise plugin changes sometime later this month.

Anyways, I hope this helps! [import]uid: 32256 topic_id: 35601 reply_id: 144767[/import]

Oh right, and I believe the iOS team completely removed facebook references from Corona Enterprise for iOS in daily build #1038
http://developer.coronalabs.com/release-ent/2013/1038
[import]uid: 32256 topic_id: 35601 reply_id: 144768[/import]

1041 works like a charm with regards to images from different sources.
Thanks Joshua! :slight_smile: [import]uid: 63706 topic_id: 35601 reply_id: 144825[/import]