Android Errors

hi all

java.lang.RuntimeException: Unable to get provider com.ansca.corona.FileContentProvider: java.lang.ClassNotFoundException: com.ansca.corona.FileContentProvider at android.app.ActivityThread.installProvider(ActivityThread.java:4663) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4290) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4232) at android.app.ActivityThread.access$1400(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4921) 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:1027) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.ansca.corona.FileContentProvider at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at android.app.ActivityThread.installProvider(ActivityThread.java:4648) java.lang.ExceptionInInitializerError at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:130) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675) at android.app.ActivityThread.access$1500(ActivityThread.java:121) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3701) 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:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ExceptionInInitializerError at com.ansca.corona.CoronaEnvironment.setLuaErrorHandler(CoronaEnvironment.java:373) at com.ansca.corona.CoronaEnvironment.\<clinit\>(CoronaEnvironment.java:41) ... 14 more Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lua: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:429) at java.lang.System.loadLibrary(System.java:554) at com.ansca.corona.JavaToNativeShim.\<clinit\>(JavaToNativeShim.java:96)

any ideas? build 1105.

Did you solved the problem? I have the same.

I see that you are an Enterprise user.

This means that the “FileContentProvider” in your “AndroidManifest.xml” file is set up wrong.  You need to make sure that your app’s package name is in that provider’s “authorities” tag.  It should look something like this…

\<manifest ...\> \<application ...\> \<provider android:name="com.ansca.corona.FileContentProvider" android:authorities="\<your.package.name\>.files" /\> \</application\> \</manifest\>

@Joshua: I have it set up as you mentioned above.

It might have something to do with the tapfortap plugin?

Your stack trace clearly states that the Java runtime cannot find the “com.ansca.corona.FileContentProvider”.  So, that’s the problem.  It has nothing to do with plugins.  I’m thinking that your Android project is not including the Corona library for some reason, which is why it can’t find this Corona class.  Are you referencing the Corona’s Android library folder via your “project.properties” file as shown in our sample projects?  If you are, then after doing an Android SDK build, you’ll find that your project’s “bin” folder will contain Corona’s class files under the “bin/classes/com/ansca/corona” directory.  If you don’t see any of those class files, then your Android app project is failing to include the Corona library.

I am a Pro user and I am also seeing that error in my Google Developer Console crash report…

Any ideas?

java.lang.RuntimeException: Unable to get provider com.ansca.corona.FileContentProvider: java.lang.ClassNotFoundException: com.ansca.corona.FileContentProvider at android.app.ActivityThread.installProvider(ActivityThread.java:4620) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4247) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4189) at android.app.ActivityThread.access$1300(ActivityThread.java:136) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4802) 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:813) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:580) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.ansca.corona.FileContentProvider at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at android.app.ActivityThread.installProvider(ActivityThread.java:4605) ... 12 mor &nbsp;

e

Renato,

I’m not sure how that ClassNotFoundException can happen to Pro users.  Not without hacking the APK.  Are you able to reproduce this error for yourself?  Are you able to run sample projects “Media/StreamingVideo” and “Networking/ComposeEmailSMS” on your Android device without any problems?  Those 2 projects use APIs that require our internal FileContentProvider class and we’re able to run them just fine.

dingo,

Can you check which Android API Level that you are targeting?  You can find out by looking at your “AndroidManifest.xml” file at the top and see the <uses-sdk android:targetSdkVersion""> tag.  If it is set to 17 or higher (not Corona’s default), then Google has introduced a breaking change where you have to explicitly “export” the content provider as instructed here…

   http://developer.android.com/guide/topics/manifest/provider-element.html#exported

Hi Joshua. Thanks for the reply.

I was not able to reproduce that error. I have 4 errors of that type being reported in my Google Dev Console… one of them is also related to the FileContentProvider but also appeared with an extra info: “Didn’t find class “com.ansca.corona.FileContentProvider” on path: /mnt/asec/com.redbeachgames.cutmypuzzle-2/pkg.apk”.

My game bundle is “com.redbeachgames.cutmypuzzle” and not “com.redbeachgames.cutmypuzzle-2”, so may be someone is hacking it?

java.lang.RuntimeException: Unable to get provider com.ansca.corona.FileContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.ansca.corona.FileContentProvider" on path: /mnt/asec/com.redbeachgames.cutmypuzzle-2/pkg.apk at android.app.ActivityThread.installProvider(ActivityThread.java:5033) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4638) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4576) at android.app.ActivityThread.access$1400(ActivityThread.java:152) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5328) 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:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ansca.corona.FileContentProvider" on path: /mnt/asec/com.redbeachgames.cutmypuzzle-2/pkg.apk at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at android.app.ActivityThread.installProvider(ActivityThread.java:5018) ... 12 more

Hmm… yeah, if someone decompiled your APK and then recompiled it targeting Android API Level 17, then I would expect an error to occur.  This is because Google made a breaking change with content providers in API Level 17.  Corona currently targets API Level 16.  We’ve tested the newest daily builds of Corona on Android 4.2 (aka: API Level 17) and 4.3 (API Level 18) devices and haven’t experienced any crashes.  I’m really not sure what else could cause ClassNotFoundException error.

Did the crash reports happen to mention what devices these errors occurred on?

Did you solved the problem? I have the same.

I see that you are an Enterprise user.

This means that the “FileContentProvider” in your “AndroidManifest.xml” file is set up wrong.  You need to make sure that your app’s package name is in that provider’s “authorities” tag.  It should look something like this…

\<manifest ...\> \<application ...\> \<provider android:name="com.ansca.corona.FileContentProvider" android:authorities="\<your.package.name\>.files" /\> \</application\> \</manifest\>

@Joshua: I have it set up as you mentioned above.

It might have something to do with the tapfortap plugin?

Renato,

We think we’ve reproduce the issue that you’ve posted.  It tuns out that Android 4.3 will create app directories ending with “-1”, “-2”, “-3”, etc. for different user accounts on a tablet.  Meaning that every user account will get their own application directory.

We’ve also discovered that a Corona made app will crash or show a black screen on startup if it is targeting Google Play and it is ran by a restricted user on an Android 4.3 device.  The crash will also only happen if the app was installed before the 2nd user account is created.  Meaning that the crash will not happen if the app is installed or re-installed after the 2nd user account is created.

Now, we were not getting a ClassNotFoundException that you posted up above, but we were getting a library not found error along with a Lua stack trace.  Not the same issue as yours, but I’m wondering if you’re running into a similar issue.

In any case, the Android 4.3 crash that I’ve mentioned has been fixed and will be made available in daily build #1199.

Hi Joshua.

Thanks for getting back to me. Sorry I did not answered you, I looked at my Google Dev Console and I didn’t find the device model that was showing that error (It allows me to filter per device, so Google has that info… but since it has hundred of devices in the filter list, it will take my forever to discover what is the buggy device…).

I looked here and I am not getting that library not found error, but it is good to know that this problem will be fixed in the #1199 daily build. I am updating my games this week, so I will wait this daily build.

Another Android error that I am seeing here is the following:

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1286) at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:451) at android.app.Activity.onBackPressed(Activity.java:2123) at android.app.Activity.onKeyUp(Activity.java:2101) at com.ansca.corona.CoronaActivity.onKeyUp(CoronaActivity.java:1786) at android.view.KeyEvent.dispatch(KeyEvent.java:2577) at android.app.Activity.dispatchKeyEvent(Activity.java:2334) at com.ansca.corona.input.RaiseKeyEventTask$1.run(RaiseKeyEventTask.java:87) 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:817) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) at dalvik.system.NativeStart.main(Native Method)

It appears to me that is more related to the device instead of the platform, am I correct?

Thanks,

Renato

Hmm… the only Corona feature (that I know of) that uses fragments is facebook.  Does your app use facebook?

My guess is that this crash happens when the back key is pressed just before a facebook dialog has been displayed.  I’ll add this to our “to be investigated” list.  So, I’m thinking that it’s not device specific.  It’s likely a race condition when pressing the back key while the dialog is being displayed or closed.  If you can figure out how to reproduce this issue on your end, then that would help expedite this matter.  Thanks for reporting this.

Your stack trace clearly states that the Java runtime cannot find the “com.ansca.corona.FileContentProvider”.  So, that’s the problem.  It has nothing to do with plugins.  I’m thinking that your Android project is not including the Corona library for some reason, which is why it can’t find this Corona class.  Are you referencing the Corona’s Android library folder via your “project.properties” file as shown in our sample projects?  If you are, then after doing an Android SDK build, you’ll find that your project’s “bin” folder will contain Corona’s class files under the “bin/classes/com/ansca/corona” directory.  If you don’t see any of those class files, then your Android app project is failing to include the Corona library.

Yes, the app used to have facebook, but we removed it. So, it should not be a problem anymore for us :slight_smile:

Thanks Joshua.

I am a Pro user and I am also seeing that error in my Google Developer Console crash report…

Any ideas?

java.lang.RuntimeException: Unable to get provider com.ansca.corona.FileContentProvider: java.lang.ClassNotFoundException: com.ansca.corona.FileContentProvider at android.app.ActivityThread.installProvider(ActivityThread.java:4620) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4247) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4189) at android.app.ActivityThread.access$1300(ActivityThread.java:136) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4802) 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:813) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:580) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.ansca.corona.FileContentProvider at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at android.app.ActivityThread.installProvider(ActivityThread.java:4605) ... 12 mor &nbsp;

e

Renato,

I’m not sure how that ClassNotFoundException can happen to Pro users.  Not without hacking the APK.  Are you able to reproduce this error for yourself?  Are you able to run sample projects “Media/StreamingVideo” and “Networking/ComposeEmailSMS” on your Android device without any problems?  Those 2 projects use APIs that require our internal FileContentProvider class and we’re able to run them just fine.