Cocos2dx 3.0 sample crashes on android

Hi,
Downloaded cocos2dx 3.0 alpha0 and tried building hellocpp sample it builds without any errors,after that i opened in eclipse and started running the sample with my android device connected,it started the sample and screen went black for few seconds and then it crashed.Dont know what is the problem if someone can help it will be really nice.

Please copy-paste the logcat output to help debug the issue. Please also tell the device and model on which the sample crashed.

It crashed in htc device,but before deploying to device i tried it in emulator,there also it opens and after few seconds it crashes,i cant give you the log now bcz i am in office. By this evening i will send you the log file,bt if possible you can also check hellocpp sample in the emulator or any android device with cocos2dx 3.0 alpha.As for as i know this version uses native activity for android i dont see any .java files,i am thinking problem exists due to that but i am not sure.Please let me know if you find the solution.

This is the log i am getting in emulator.

09-30 11:52:43.394: D/libEGL(952): loaded /system/lib/egl/libEGL_emulation.so
09-30 11:52:43.436: D/(952): HostConnection::get() New Host Connection established 0x2a1cb2a0, tid 965
09-30 11:52:43.695: D/libEGL(952): loaded /system/lib/egl/libGLESv1_CM_emulation.so
09-30 11:52:43.994: D/libEGL(952): loaded /system/lib/egl/libGLESv2_emulation.so
09-30 11:52:44.535: D/JniHelper(952): JniHelper::setJavaVM(0x2a009c68), pthread_self() = 2A1C92B0
09-30 11:52:44.535: W/dalvikvm(952): dvmFindClassByName rejecting ‘org/cocos2dx/lib/Cocos2dxHelper’
09-30 11:52:44.795: W/dalvikvm(952): JNI WARNING: JNI method called with exception pending
09-30 11:52:44.795: W/dalvikvm(952): in Ldalvik/system/NativeStart;.run:()V (GetStaticMethodID)
09-30 11:52:44.844: W/dalvikvm(952): Pending exception is:
09-30 11:52:44.844: I/dalvikvm(952): java.lang.ClassNotFoundException: Didn’t find class “org/cocos2dx/lib/Cocos2dxHelper” on path: DexPathList[[zip file “/data/app/org.cocos2dx.hellocpp-1.apk”],nativeLibraryDirectories=[/data/app-lib/org.cocos2dx.hellocpp-1, /system/lib]]
09-30 11:52:44.885: I/dalvikvm(952): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
09-30 11:52:44.935: I/dalvikvm(952): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-30 11:52:44.935: I/dalvikvm(952): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-30 11:52:44.935: I/dalvikvm(952): at dalvik.system.NativeStart.run(Native Method)
09-30 11:52:45.015: I/dalvikvm(952): “Thread-81” prio=5 tid=11 NATIVE
09-30 11:52:45.015: I/dalvikvm(952): | group=“main” sCount=0 dsCount=0 obj=0x416e9990 self=0x2a1cdf58
09-30 11:52:45.045: I/dalvikvm(952): | sysTid=965 nice=0 sched=0/0 cgrp=apps handle=706515632
09-30 11:52:45.076: I/dalvikvm(952): | state=R schedstat=( 308375567 1505839263 79 ) utm=18 stm=12 core=0
09-30 11:52:45.365: I/dalvikvm(952): #00 pc 000012fe /system/lib/libcorkscrew.so (unwind_backtrace_thread+29)
09-30 11:52:45.365: I/dalvikvm(952): #01 pc 0005fd92 /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+33)
09-30 11:52:45.365: I/dalvikvm(952): #02 pc 00053e28 /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const**, Thread**, bool)+395)
09-30 11:52:45.365: I/dalvikvm(952): #03 pc 00053e96 /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
09-30 11:52:45.375: I/dalvikvm(952): #04 pc 000385c0 /system/lib/libdvm.so
09-30 11:52:45.375: I/dalvikvm(952): #05 pc 0003dbcc /system/lib/libdvm.so
09-30 11:52:45.396: I/dalvikvm(952): #06 pc 00113f32 /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so (cocos2d::JniHelper::getStaticMethodInfo(cocos2d::JniMethodInfo_&, char const**, char const**, char const*)+93)
09-30 11:52:45.396: I/dalvikvm(952): #07 pc 00112c4c /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so
09-30 11:52:45.405: I/dalvikvm(952): #08 pc 001c7654 /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so
09-30 11:52:45.405: I/dalvikvm(952): #09 pc 001131e6 /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so (android_main+125)
09-30 11:52:45.405: I/dalvikvm(952): #10 pc 001c74c2 /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so
09-30 11:52:45.405: I/dalvikvm(952): #11 pc 0000ca58 /system/lib/libc.so (__thread_entry+72)
09-30 11:52:45.427: I/dalvikvm(952): #12 pc 0000cbd4 /system/lib/libc.so (pthread_create+208)
09-30 11:52:45.427: I/dalvikvm(952): at dalvik.system.NativeStart.run(Native Method)
09-30 11:52:45.427: E/dalvikvm(952): VM aborting
09-30 11:52:45.435: A/libc(952): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 965 (cos2dx.hellocpp)

I met the problem also. Please help me.
10-17 20:38:32.283: W/dalvikvm(27898): dvmFindClassByName rejecting ‘org/cocos2dx/lib/Cocos2dxHelper’

Hi I have the same error,

org.cocos2dx.helpcpp libc Fatal sign 11, could you find a fix?

I could solve this, With ndk-stack I could check the problem were the assets.

Monica Gerchinhoren wrote:

I could solve this, With ndk-stack I could check the problem were the assets.

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000005c
Stack frame #00 pc 0006d362 /system/lib/libdvm.so (dvmInitClass+393)
Stack frame #01 pc 0004d745 /system/lib/libdvm.so
Assertion failed: (debug_str*.is_mapped && index < debug_str*.size()), function get_debug_str, file elff/elf_file.h, line 300.
Stack frame #02 pc 0035552c /data/app-lib/com.starriver.testcocos2dx3-2/libcocos2dcpp.so (_JNIEnv::GetStaticMethodID(_jclass**, char const**, char const*)+56)Abort trap: 6
Where is the asserts? I cannot find the file named elf_file.h

Just wondering, are you trying to run from command line or from eclipse? You need to add the cocos2dx android project to your workspace. That is needed to be able to build and run the project. And what is where “org/cocos2dx/lib/Cocos2dxHelper” and other related classes are defined. This android/eclipse project is in cocos2dx/platform/android.

Sachin Garg wrote:

Just wondering, are you trying to run from command line or from eclipse? You need to add the cocos2dx android project to your workspace. That is needed to be able to build and run the project. And what is where “org/cocos2dx/lib/Cocos2dxHelper” and other related classes are defined. This android/eclipse project is in cocos2dx/platform/android.

I have added cocos2d in eclipse and helloWorld can run on device, but the point is black screen and error.

Monica Gerchinhoren wrote:

I could solve this, With ndk-stack I could check the problem were the assets.

How to solve this problem?thx.

I encountered this problem as well today.
Problem:

  • The android project folder (proj.android) doesn’t not contain the java source, which include Cocos2dxHelper

Solution:

  • Copy the java source at cocos2d-x/cocos/2d/platform/android/java to proj.anroid/src

Example:
from here:

$ pwd
/cocos2d-x/cocos/2d/platform/android/java
$ ls */*/*/*
Cocos2dxBitmap.java     Cocos2dxHelper.java     Cocos2dxMusic.java
Cocos2dxEditBoxDialog.java  Cocos2dxLocalStorage.java   Cocos2dxSound.java
Cocos2dxEditText.java       Cocos2dxLuaJavaBridge.java  Cocos2dxTypefaces.java

to here:

$ pwd
/cocos2d-x/projects/TestCpp/proj.android/src
$ ls */*/*/*
org/cocos2dx/lib/Cocos2dxBitmap.java        org/cocos2dx/lib/Cocos2dxLuaJavaBridge.java
org/cocos2dx/lib/Cocos2dxEditBoxDialog.java org/cocos2dx/lib/Cocos2dxMusic.java
org/cocos2dx/lib/Cocos2dxEditText.java      org/cocos2dx/lib/Cocos2dxSound.java
org/cocos2dx/lib/Cocos2dxHelper.java        org/cocos2dx/lib/Cocos2dxTypefaces.java
org/cocos2dx/lib/Cocos2dxLocalStorage.java

I encountered this problem as well today.
Problem:

  • The android project folder (proj.android) doesn’t not contain the java source, which include Cocos2dxHelper

Solution:

  • Copy the java source at cocos2d-x/cocos/2d/platform/android/java to proj.anroid/src

Example:
from here:

$ pwd
/cocos2d-x/cocos/2d/platform/android/java
$ ls */*/*/*
Cocos2dxBitmap.java     Cocos2dxHelper.java     Cocos2dxMusic.java
Cocos2dxEditBoxDialog.java  Cocos2dxLocalStorage.java   Cocos2dxSound.java
Cocos2dxEditText.java       Cocos2dxLuaJavaBridge.java  Cocos2dxTypefaces.java

to here:

$ pwd
/cocos2d-x/projects/TestCpp/proj.android/src
$ ls */*/*/*
org/cocos2dx/lib/Cocos2dxBitmap.java        org/cocos2dx/lib/Cocos2dxLuaJavaBridge.java
org/cocos2dx/lib/Cocos2dxEditBoxDialog.java org/cocos2dx/lib/Cocos2dxMusic.java
org/cocos2dx/lib/Cocos2dxEditText.java      org/cocos2dx/lib/Cocos2dxSound.java
org/cocos2dx/lib/Cocos2dxHelper.java        org/cocos2dx/lib/Cocos2dxTypefaces.java
org/cocos2dx/lib/Cocos2dxLocalStorage.java

@kencoder thank you very much~

Help Me !