What's "com.ansca.corona.storage.FileContentProvider", why is it missing for some Android devices?

@Joshua

(1) Yes, I am using plugins, here is my build.settings at the end.

(2) The build number should be #2155

(3) I cannot reproduce this issue on my devices. I see the crash reports from Google Play Development Console. The crashes were experienced by the actual users. It does not happen often though. I think there are thousands of app usage per day but this crash only happen twice in 7 days. 

settings = { orientation = { default = "portrait", supported = { "portrait" } }, iphone = { plist = { UIStatusBarHidden = true, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", }, CFBundleDisplayName = "MyApp", } }, -- Android permissions android = { versionCode = "1611", usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_FINE\_LOCATION", -- Fetches location via GPS. "android.permission.ACCESS\_COARSE\_LOCATION", -- Fetches location via WiFi or cellular service. "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, usesFeatures = { { name = "android.hardware.location", required = false }, { name = "android.hardware.location.gps", required = false }, { name = "android.hardware.location.network", required = false }, }, }, plugins = { ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs", -- supportedPlatforms = { iphone = true }, }, ["CoronaProvider.analytics.flurry"] = { publisherId = "com.coronalabs", }, ["CoronaProvider.ads.iads"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone = true }, }, ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs", -- supportedPlatforms = { android = true }, }, }, }

The social plugin that you are using is the only plugin (that I’m aware of) that uses the FileContentProvider that you are seeing in the log.  Try using the social plugin features on your own Android device to see if you can reproduce it for yourself.  Particularly posting a file/image to the social service, which I suspect might be triggering this.  Just trying to narrow down the issue, because we’re not sure what the cause is yet.

I cannot reproduce this problem. However, I did get one more crash report today with exactly the same call trace.

Please note that this bug does not happen often at all. Probably once every thousands of app sessions.

Therefore, in order to solve this bug, probably you have to look at the call trace report generated when it crashes.

java.lang.RuntimeException: Unable to get provider com.ansca.corona.storage.FileContentProvider: java.lang.ClassNotFoundException: com.ansca.corona.storage.FileContentProvider in loader dalvik.system.PathClassLoader[/mnt/asec/tw.com.appstudio.app.myapp-2/pkg.apk] at android.app.ActivityThread.installProvider(ActivityThread.java:3565) at android.app.ActivityThread.installContentProviders(ActivityThread.java:3317) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3273) at android.app.ActivityThread.access$2200(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:973) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3691) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.ansca.corona.storage.FileContentProvider in loader dalvik.system.PathClassLoader[/mnt/asec/tw.com.appstudio.app.myapp-2/pkg.apk] at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) at java.lang.ClassLoader.loadClass(ClassLoader.java:551) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at android.app.ActivityThread.installProvider(ActivityThread.java:3550) ... 12 more

The thing is, the crash is not happening in our code.  The stack trace you gave me is proof of this.  The Android operating system is failing to find Corona’s “com.ansca.corona.storage.FileContentProvider” class, which definitely exists within the Corona library.

I’m actually wondering if we’re running into a bug with the Android OS that we might have to work-around.  The curious part about the stack trace here is that I see a “tw.com.appstudio.app.myapp-2” for your package name.  I’m guessing your package name does not have a “-2” in it, so it sounds like this is a 2nd copy of your APK on the device.  I think that situation can happen when someone uses Android 4.3’s “restricted profile” feature.  I know that a restricted profile account gets its own application data directory, but the trace suggests that they got their own copy of the APK as well… making me think that its using an older version of your APK that does not contain the Corona class mentioned above.

Does Google Play provide any information about the device model and OS version these crashes happened on?

The device model & OS version:

- HTC Sensation XL / Android 4.0.3~4.0.4

- Galaxy Beam (GT-I8530) / Android 2.3.3-2.3.7

My package name does not contain “-2”. If it’s something that belongs to the users’ fault, I think it’s ok to ignore this issue. For one more information, a user left a crash report message “cannot start the app”. I guess the crash happens when the app launches.

Hmm… I’m not sure what could possible be wrong.  It sounds like a bug in the Android OS (or a forked version of the OS) because other native Android developers have raised this same issue up here…

   https://code.google.com/p/android/issues/detail?id=23201

Based on what I’ve read, some native Android developers believe that this issue happen when the install application becomes corrupted.  In which case, the solution is to re-install the app.  So, that’s what I’d recommend that you tell your customers to do.  Not sure what else to advise.

I think you are right. It’s probably Android OS bug.

If there is some unusual development for this issue, I will update this post.

Thanks for the help.

Is there an example AndroidManifest.xml to show the correct way to add the provider?

<!-- Corona content provider required to access this app’s local files. -->

<provider android:name=“com.ansca.corona.storage.FileContentProvider”

          android:authorities=“tv.ouya.examples.corona.inapppurchases.files”

          android:exported=“true” />

 

Where the authorities is your package name followed by dot files.

 

This fits into your AndroidManifest.xml within Application at the Activity level.

Tim,

Can you give me the exact error message please?  It should tell you exactly what’s wrong and how to solve it.  Such as if the package name is wrong or if the “authorities” attribute isn’t using your app’s package name.  Note that we’ve moved our “FileContentProvider” class under the “storage” package name (aka: namespace), that was the big change we made in the past year, but what you’ve posted has the correct package name.

Also, the sample projects under Corona Enterprise will show the correct way to set up this provider.

My issue is solved using the provider string I posted above.

When I was replying the forum software glitched and I lost my verbose story in the post.

Essentially I just added the new provider entry to the AndroidManifest.xml and that fixed my issue.

Thanks!

Is there an example AndroidManifest.xml to show the correct way to add the provider?

<!-- Corona content provider required to access this app’s local files. -->

<provider android:name=“com.ansca.corona.storage.FileContentProvider”

          android:authorities=“tv.ouya.examples.corona.inapppurchases.files”

          android:exported=“true” />

 

Where the authorities is your package name followed by dot files.

 

This fits into your AndroidManifest.xml within Application at the Activity level.

Tim,

Can you give me the exact error message please?  It should tell you exactly what’s wrong and how to solve it.  Such as if the package name is wrong or if the “authorities” attribute isn’t using your app’s package name.  Note that we’ve moved our “FileContentProvider” class under the “storage” package name (aka: namespace), that was the big change we made in the past year, but what you’ve posted has the correct package name.

Also, the sample projects under Corona Enterprise will show the correct way to set up this provider.

My issue is solved using the provider string I posted above.

When I was replying the forum software glitched and I lost my verbose story in the post.

Essentially I just added the new provider entry to the AndroidManifest.xml and that fixed my issue.

Thanks!