android example problem

Hi guys,

I have been trying to test the sample-android-ChildView-master in Eclipse… and so far I have got the app to run in the simulator, but I get the message: 

“The application ChildView (process com.example.app) has stopped unexpectedly. Please try again.”

The corona card never gets displayed, but the native part of the app works fine. I think it might have to do with the license. Where exactly should it be inside my project?

Thanks! 

What does the log say?  The licensing file should be next to the each main.lua file.

Hi dchan, this is what I get:

04-18 11:08:12.493: E/AndroidRuntime(335): FATAL EXCEPTION: main 04-18 11:08:12.493: E/AndroidRuntime(335): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.app/com.example.app.MainActivity}: java.lang.ClassNotFoundException: com.example.app.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.app-1.apk] 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.os.Handler.dispatchMessage(Handler.java:99) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.os.Looper.loop(Looper.java:123) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread.main(ActivityThread.java:3683) 04-18 11:08:12.493: E/AndroidRuntime(335): at java.lang.reflect.Method.invokeNative(Native Method) 04-18 11:08:12.493: E/AndroidRuntime(335): at java.lang.reflect.Method.invoke(Method.java:507) 04-18 11:08:12.493: E/AndroidRuntime(335): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

That log suggests it has nothing to do with licensing.  Do you have a class named MainActivity in the com.example.app package namespace?

you were right, I moved the mainactivity to the src folder. but now I’m getting the following errors when I run the emulator :

04-18 19:00:31.608: W/dalvikvm(330): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/ansca/corona/JavaToNativeShim; 04-18 19:00:31.608: W/dalvikvm(330): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/ansca/corona/CoronaEnvironment; 04-18 19:00:31.618: D/AndroidRuntime(330): Shutting down VM 04-18 19:00:31.618: W/dalvikvm(330): threadid=1: thread exiting with uncaught exception (group=0x40015560) 04-18 19:00:31.658: E/AndroidRuntime(330): FATAL EXCEPTION: main 04-18 19:00:31.658: E/AndroidRuntime(330): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class com.ansca.corona.CoronaView 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.os.Handler.dispatchMessage(Handler.java:99) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.os.Looper.loop(Looper.java:123) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.main(ActivityThread.java:3683) 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.reflect.Method.invokeNative(Native Method) 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.reflect.Method.invoke(Method.java:507) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 04-18 19:00:31.658: E/AndroidRuntime(330): at dalvik.system.NativeStart.main(Native Method) 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.ansca.corona.CoronaView 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.example.app.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:63) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.Activity.performStart(Activity.java:3791) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1620) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 11 more 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: java.lang.reflect.InvocationTargetException 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.reflect.Constructor.constructNative(Native Method) 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 25 more 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: java.lang.ExceptionInInitializerError 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.CoronaView.internalInit(CoronaView.java:66) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.CoronaView.\<init\>(CoronaView.java:56) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 28 more 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: java.lang.ExceptionInInitializerError 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.CoronaEnvironment.setLuaErrorHandler(CoronaEnvironment.java:322) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.CoronaEnvironment.\<clinit\>(CoronaEnvironment.java:50) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 30 more 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lua: findLibrary returned null 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.Runtime.loadLibrary(Runtime.java:429) 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.System.loadLibrary(System.java:554) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.JavaToNativeShim.\<clinit\>(JavaToNativeShim.java:117) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 32 more

this is my manifest.xml

\<?xml version="1.0" encoding="utf-8"?\> \<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" \> \<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="10"/\> \<application android:allowBackup="true" android:icon="@drawable/ic\_launcher" android:label="@string/app\_name" android:theme="@style/AppTheme" \> \<activity android:name="com.example.app.MainActivity" android:label="@string/app\_name" \> \<intent-filter\> \<action android:name="android.intent.action.MAIN" /\> \<category android:name="android.intent.category.LAUNCHER" /\> \</intent-filter\> \</activity\> \</application\> \</manifest\>

the java buildpath

fxrm9f.jpg

and my folder structure

structure.png

Whats in your libs/armeabi-v7a folder?  That should have all the .so files and there is not need to have a jniLibs folder.

Same @potsifera problem.

It is solved as @dchan said. You need to move the  armeabi-v7a folder from the  jniLibs to the libs folder.

This is the result that I got (Sorry for the small image. This post is not allowing to post bigger files)

Hi guys, I want to test the sample-android-ChildView-master in Eclipse ,after i download the project and import android code into workspace,i get an error:

how do you solve it?

Thanks.

What’s the error?

What does the log say?  The licensing file should be next to the each main.lua file.

Hi dchan, this is what I get:

04-18 11:08:12.493: E/AndroidRuntime(335): FATAL EXCEPTION: main 04-18 11:08:12.493: E/AndroidRuntime(335): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.app/com.example.app.MainActivity}: java.lang.ClassNotFoundException: com.example.app.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.app-1.apk] 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.os.Handler.dispatchMessage(Handler.java:99) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.os.Looper.loop(Looper.java:123) 04-18 11:08:12.493: E/AndroidRuntime(335): at android.app.ActivityThread.main(ActivityThread.java:3683) 04-18 11:08:12.493: E/AndroidRuntime(335): at java.lang.reflect.Method.invokeNative(Native Method) 04-18 11:08:12.493: E/AndroidRuntime(335): at java.lang.reflect.Method.invoke(Method.java:507) 04-18 11:08:12.493: E/AndroidRuntime(335): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

That log suggests it has nothing to do with licensing.  Do you have a class named MainActivity in the com.example.app package namespace?

you were right, I moved the mainactivity to the src folder. but now I’m getting the following errors when I run the emulator :

04-18 19:00:31.608: W/dalvikvm(330): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/ansca/corona/JavaToNativeShim; 04-18 19:00:31.608: W/dalvikvm(330): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/ansca/corona/CoronaEnvironment; 04-18 19:00:31.618: D/AndroidRuntime(330): Shutting down VM 04-18 19:00:31.618: W/dalvikvm(330): threadid=1: thread exiting with uncaught exception (group=0x40015560) 04-18 19:00:31.658: E/AndroidRuntime(330): FATAL EXCEPTION: main 04-18 19:00:31.658: E/AndroidRuntime(330): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class com.ansca.corona.CoronaView 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.os.Handler.dispatchMessage(Handler.java:99) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.os.Looper.loop(Looper.java:123) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.main(ActivityThread.java:3683) 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.reflect.Method.invokeNative(Native Method) 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.reflect.Method.invoke(Method.java:507) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 04-18 19:00:31.658: E/AndroidRuntime(330): at dalvik.system.NativeStart.main(Native Method) 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.ansca.corona.CoronaView 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.example.app.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:63) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.Activity.performStart(Activity.java:3791) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1620) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 11 more 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: java.lang.reflect.InvocationTargetException 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.reflect.Constructor.constructNative(Native Method) 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 04-18 19:00:31.658: E/AndroidRuntime(330): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 25 more 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: java.lang.ExceptionInInitializerError 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.CoronaView.internalInit(CoronaView.java:66) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.CoronaView.\<init\>(CoronaView.java:56) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 28 more 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: java.lang.ExceptionInInitializerError 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.CoronaEnvironment.setLuaErrorHandler(CoronaEnvironment.java:322) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.CoronaEnvironment.\<clinit\>(CoronaEnvironment.java:50) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 30 more 04-18 19:00:31.658: E/AndroidRuntime(330): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lua: findLibrary returned null 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.Runtime.loadLibrary(Runtime.java:429) 04-18 19:00:31.658: E/AndroidRuntime(330): at java.lang.System.loadLibrary(System.java:554) 04-18 19:00:31.658: E/AndroidRuntime(330): at com.ansca.corona.JavaToNativeShim.\<clinit\>(JavaToNativeShim.java:117) 04-18 19:00:31.658: E/AndroidRuntime(330): ... 32 more

this is my manifest.xml

\<?xml version="1.0" encoding="utf-8"?\> \<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" \> \<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="10"/\> \<application android:allowBackup="true" android:icon="@drawable/ic\_launcher" android:label="@string/app\_name" android:theme="@style/AppTheme" \> \<activity android:name="com.example.app.MainActivity" android:label="@string/app\_name" \> \<intent-filter\> \<action android:name="android.intent.action.MAIN" /\> \<category android:name="android.intent.category.LAUNCHER" /\> \</intent-filter\> \</activity\> \</application\> \</manifest\>

the java buildpath

fxrm9f.jpg

and my folder structure

structure.png

Whats in your libs/armeabi-v7a folder?  That should have all the .so files and there is not need to have a jniLibs folder.

Same @potsifera problem.

It is solved as @dchan said. You need to move the  armeabi-v7a folder from the  jniLibs to the libs folder.

This is the result that I got (Sorry for the small image. This post is not allowing to post bigger files)

Hi guys, I want to test the sample-android-ChildView-master in Eclipse ,after i download the project and import android code into workspace,i get an error:

how do you solve it?

Thanks.

What’s the error?