I am newbie in COCOS2D for Android, While trying to run the sample project(HelloWorld) provided from cocos2d I got " FATAL EXCEPTION: main" and in detail that arrived in LogCat
05-31 19:11:46.920: E/AndroidRuntime(7719): FATAL EXCEPTION: main
05-31 19:11:46.920: E/AndroidRuntime(7719): java.lang.ExceptionInInitializerError
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.Class.newInstanceImpl(Native Method)
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.Class.newInstance(Class.java:1429)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.os.Looper.loop(Looper.java:123)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.reflect.Method.invokeNative(Native Method)
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.reflect.Method.invoke(Method.java:521)
05-31 19:11:46.920: E/AndroidRuntime(7719): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-31 19:11:46.920: E/AndroidRuntime(7719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-31 19:11:46.920: E/AndroidRuntime(7719): at dalvik.system.NativeStart.main(Native Method)
05-31 19:11:46.920: E/AndroidRuntime(7719): Caused by: java.lang.UnsatisfiedLinkError: Library helloworld not found
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.Runtime.loadLibrary(Runtime.java:461)
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.System.loadLibrary(System.java:557)
05-31 19:11:46.920: E/AndroidRuntime(7719): at org.cocos2dx.application.ApplicationDemo.<clinit>(ApplicationDemo.java:81)
05-31 19:11:46.920: E/AndroidRuntime(7719): ... 15 more
So can anyone please help with some idea/solution.
Again i followed reference from "http://www.multigesture.net/articles/how-to-setup-cocos2d-x-windows-and-android/"
Thanks a lot.
I recomend you to change libraries to cocos2d-x, because cocos2d for android won't be updated anymore.
Cocos2d-x works in C++, and uses JNI (Java native interface) to work. Here is all the info you will need to start using it.
Related
i'm trying to make ImageButton using
android:background="?attr/selectableItemBackground" but my app crashed. I just following this answer and this question. Any idea?
Thanks for your help.
activity.xml
<ImageButton
android:id="#+id/signUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/signIn"
android:layout_alignParentBottom="true"
android:layout_marginBottom="80dp"
android:background="?attr/selectableItemBackground"
android:src="#drawable/sign_up"
android:contentDescription="#string/button_sign_up"
/>
Log Cat
05-31 18:50:24.077: W/dalvikvm(28619): threadid=1: thread exiting with uncaught exception (group=0x41d0b2a0)
05-31 18:50:24.082: E/AndroidRuntime(28619): FATAL EXCEPTION: main
05-31 18:50:24.082: E/AndroidRuntime(28619): java.lang.RuntimeException: Unable to start activity ComponentInfo{yai.properti.tujuh.tujuh.tujuh/yai.properti.tujuh.tujuh.tujuh.WelcomeActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ImageButton
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.access$700(ActivityThread.java:140)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.os.Looper.loop(Looper.java:137)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.main(ActivityThread.java:4921)
05-31 18:50:24.082: E/AndroidRuntime(28619): at java.lang.reflect.Method.invokeNative(Native Method)
05-31 18:50:24.082: E/AndroidRuntime(28619): at java.lang.reflect.Method.invoke(Method.java:511)
05-31 18:50:24.082: E/AndroidRuntime(28619): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
05-31 18:50:24.082: E/AndroidRuntime(28619): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
05-31 18:50:24.082: E/AndroidRuntime(28619): at dalvik.system.NativeStart.main(Native Method)
05-31 18:50:24.082: E/AndroidRuntime(28619): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ImageButton
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
05-31 18:50:24.082: E/AndroidRuntime(28619): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-31 18:50:24.082: E/AndroidRuntime(28619): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.Activity.setContentView(Activity.java:1924)
05-31 18:50:24.082: E/AndroidRuntime(28619): at yai.properti.tujuh.tujuh.tujuh.WelcomeActivity.onCreate(WelcomeActivity.java:19)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.Activity.performCreate(Activity.java:5188)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
05-31 18:50:24.082: E/AndroidRuntime(28619): ... 11 more
05-31 18:50:24.082: E/AndroidRuntime(28619): Caused by: java.lang.reflect.InvocationTargetException
05-31 18:50:24.082: E/AndroidRuntime(28619): at java.lang.reflect.Constructor.constructNative(Native Method)
05-31 18:50:24.082: E/AndroidRuntime(28619): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
05-31 18:50:24.082: E/AndroidRuntime(28619): ... 24 more
05-31 18:50:24.082: E/AndroidRuntime(28619): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f010015 a=-1}
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.content.res.Resources.loadDrawable(Resources.java:1925)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.View.<init>(View.java:3449)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.widget.ImageView.<init>(ImageView.java:114)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.widget.ImageButton.<init>(ImageButton.java:87)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.widget.ImageButton.<init>(ImageButton.java:83)
05-31 18:50:24.082: E/AndroidRuntime(28619): ... 27 more
#Gopal Gopi is correct. If you have the appcompat v7 imported properly into your project, use this for android:background in your xml:
android:background="?android:attr/selectableItemBackground"
Also, make sure that whatever item you use this on has android:clickable="true"
Good luck!
To make it work you should use AppCompact base theme in your App or Activity. Like following:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>
Following this tutorial: Getting started with Android.
I try to create my first phonegap project using Eclipse. However, when clicking on the icon of "Cordova Example"(name of the application from the example of PhoneGap) on the screen of device. An error named : "the application Cordova Example (process org.apache.cordova.example) has stopped unexpectedly. Please try again" occurs.
This is the log file when error occurs:
01-02 09:40:46.280: D/AndroidRuntime(310): Shutting down VM
01-02 09:40:46.280: W/dalvikvm(310): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
01-02 09:40:46.308: E/AndroidRuntime(310): FATAL EXCEPTION: main
01-02 09:40:46.308: E/AndroidRuntime(310): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.apache.cordova.example/org.apache.cordova.example.cordovaExample}: java.lang.ClassNotFoundException: org.apache.cordova.example.cordovaExample in loader dalvik.system.PathClassLoader[/data/app/org.apache.cordova.example-2.apk]
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.os.Handler.dispatchMessage(Handler.java:99)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.os.Looper.loop(Looper.java:123)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-02 09:40:46.308: E/AndroidRuntime(310): at java.lang.reflect.Method.invokeNative(Native Method)
01-02 09:40:46.308: E/AndroidRuntime(310): at java.lang.reflect.Method.invoke(Method.java:521)
01-02 09:40:46.308: E/AndroidRuntime(310): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-02 09:40:46.308: E/AndroidRuntime(310): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-02 09:40:46.308: E/AndroidRuntime(310): at dalvik.system.NativeStart.main(Native Method)
01-02 09:40:46.308: E/AndroidRuntime(310): Caused by: java.lang.ClassNotFoundException: org.apache.cordova.example.cordovaExample in loader dalvik.system.PathClassLoader[/data/app/org.apache.cordova.example-2.apk]
01-02 09:40:46.308: E/AndroidRuntime(310): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-02 09:40:46.308: E/AndroidRuntime(310): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-02 09:40:46.308: E/AndroidRuntime(310): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
01-02 09:40:46.308: E/AndroidRuntime(310): ... 11 more
The java.lang.ClassNotFoundException seems like can't find your Main Class, it could be a name problem of your java main class or in config.xml or in manifest, check all names are correctly.
Regards.
i'm getting this message when i run my application i don't know why i'm getting it could any one help me. here is the logcat.
java.lang.VerifyError: com.kosh.me.Smaller
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
This happens when the build library classes conflict with those at run-time. Try performing a Clean of your project followed by a build.
I used iSpeech Demo to set up a test application with iSpeech SDK but it is giving me the following exception on which I am lost...
05-31 13:41:23.218: I/dalvikvm(271): Could not find method org.ispeech.SpeechSynthesis.getInstance, referenced from method org.ispeech.sdksample.TTSActivity.prepareTTSEngine
05-31 13:41:23.218: W/dalvikvm(271): VFY: unable to resolve static method 31: Lorg/ispeech/SpeechSynthesis;.getInstance (Landroid/app/Activity;)Lorg/ispeech/SpeechSynthesis;
05-31 13:41:23.218: D/dalvikvm(271): VFY: replacing opcode 0x71 at 0x0000
05-31 13:41:23.228: W/dalvikvm(271): VFY: unable to resolve exception class 37 (Lorg/ispeech/error/InvalidApiKeyException;)
05-31 13:41:23.228: W/dalvikvm(271): VFY: unable to find exception handler at addr 0x11
05-31 13:41:23.228: W/dalvikvm(271): VFY: rejected Lorg/ispeech/sdksample/TTSActivity;.prepareTTSEngine ()V
05-31 13:41:23.228: W/dalvikvm(271): VFY: rejecting opcode 0x0d at 0x0011
05-31 13:41:23.228: W/dalvikvm(271): VFY: rejected Lorg/ispeech/sdksample/TTSActivity;.prepareTTSEngine ()V
05-31 13:41:23.228: W/dalvikvm(271): Verifier rejected class Lorg/ispeech/sdksample/TTSActivity;
05-31 13:41:23.228: W/dalvikvm(271): Class init failed in newInstance call (Lorg/ispeech/sdksample/TTSActivity;)
05-31 13:41:23.228: D/AndroidRuntime(271): Shutting down VM
05-31 13:41:23.228: W/dalvikvm(271): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-31 13:41:23.248: E/AndroidRuntime(271): FATAL EXCEPTION: main
05-31 13:41:23.248: E/AndroidRuntime(271): java.lang.VerifyError: org.ispeech.sdksample.TTSActivity
05-31 13:41:23.248: E/AndroidRuntime(271): at java.lang.Class.newInstanceImpl(Native Method)
05-31 13:41:23.248: E/AndroidRuntime(271): at java.lang.Class.newInstance(Class.java:1429)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.os.Looper.loop(Looper.java:123)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-31 13:41:23.248: E/AndroidRuntime(271): at java.lang.reflect.Method.invokeNative(Native Method)
05-31 13:41:23.248: E/AndroidRuntime(271): at java.lang.reflect.Method.invoke(Method.java:521)
05-31 13:41:23.248: E/AndroidRuntime(271): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-31 13:41:23.248: E/AndroidRuntime(271): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-31 13:41:23.248: E/AndroidRuntime(271): at dalvik.system.NativeStart.main(Native Method)
can someone help me solve this?
This thread on their forums seems to answer your question:
http://www.ispeech.org/forums/showthread.php/942-Verify-Error
15 reports
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oas.fruitkungfufree/com.openfeint.internal.ui.IntroFlow}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.openfeint.internal.Util.setOrientation(Util.java:36)
at com.openfeint.internal.ui.NestedWindow.onCreate(NestedWindow.java:32)
at com.openfeint.internal.ui.WebNav.onCreate(WebNav.java:93)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
Does any one have a solution for this??
This is a problem with your code, you can't use an object that is null. This is a hint.