[coco2d-x3.0RC1] Cant deploy HelloWorld to Emulator, get error A/libc(1580): Fatal signal 11 (SIGSEGV)

Hi,

I’m trying to stick closely to guide from wiki but it cannot help me. When try to “run as Android app” to install to Emulator, when start app nothing happen instead of getting this error “A/libc(1580): Fatal signal 11 (SIGSEGV)”

First time i use CocoStudio scene editor:

  1. Check setup.py, everything 's ok (found and added)
  2. CocoStudio scene editor -> new project
  3. Uncheck “no code”, select Cpp, yes
  4. Go to [MyProject]\proj.android, run build_native.py
  5. Check command prompt, confirm file libcocos2dcpp.so installed [x86][armeabi][armeabi-v7a]
  6. Using Eclipse (from adt bundle). Import [MyProject]\proj.android
  7. Then import libcocos2dx from [MyProject]\cocos2d\cocos\2d\platform\android\java
  8. Run as Android application
    Result: file .apk has been installed but cannot be started. Here is logcat:

04-09 15:17:15.714: E/Trace(1580): error opening trace file: No such file or directory (2) 04-09 15:17:15.721: D/Cocos2dxActivity(1580): model=Android SDK built for x86 04-09 15:17:15.721: D/Cocos2dxActivity(1580): product=sdk_x86 04-09 15:17:15.721: D/Cocos2dxActivity(1580): isEmulator=true 04-09 15:17:15.721: D/dalvikvm(1580): Trying to load lib /data/data/com.DonoEntertainment.TestHello/lib/libcocos2dcpp.so 0xb586a7f8 04-09 15:17:15.721: D/dalvikvm(1580): Added shared lib /data/data/com.DonoEntertainment.TestHello/lib/libcocos2dcpp.so 0xb586a7f8 04-09 15:17:15.721: D/JniHelper(1580): JniHelper::setJavaVM(0xb8dc10b0), pthread_self() = -1208982464 04-09 15:17:15.732: W/dalvikvm(1580): JNI WARNING: 0xb586a7f8 is not a valid JNI reference 04-09 15:17:15.732: W/dalvikvm(1580): in Lorg/cocos2dx/lib/Cocos2dxRenderer;.nativeOnResume:()V (CallObjectMethodV) 04-09 15:17:15.732: I/dalvikvm(1580): "GLThread 77" prio=5 tid=10 RUNNABLE 04-09 15:17:15.732: I/dalvikvm(1580): | group="main" sCount=0 dsCount=0 obj=0xb58876c0 self=0xb8ef7fa8 04-09 15:17:15.732: I/dalvikvm(1580): | sysTid=1593 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=-1192612672 04-09 15:17:15.732: I/dalvikvm(1580): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 04-09 15:17:15.732: I/dalvikvm(1580): at org.cocos2dx.lib.Cocos2dxRenderer.nativeOnResume(Native Method) 04-09 15:17:15.732: I/dalvikvm(1580): at org.cocos2dx.lib.Cocos2dxRenderer.handleOnResume(Cocos2dxRenderer.java:149) 04-09 15:17:15.732: I/dalvikvm(1580): at org.cocos2dx.lib.Cocos2dxGLSurfaceView$3.run(Cocos2dxGLSurfaceView.java:165) 04-09 15:17:15.732: I/dalvikvm(1580): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462) 04-09 15:17:15.732: I/dalvikvm(1580): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240) 04-09 15:17:15.732: E/dalvikvm(1580): VM aborting 04-09 15:17:15.732: A/libc(1580): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 1593 (Thread-77)

The second time i used cocos console:

  1. Check setup.py, everything 's ok (found and added)
  2. using cocos new MyGame -p com.MyCompany.MyGame -l cpp -d [MyProject]
  3. Go to [MyProject]\proj.android, run build_native.py
  4. Check command prompt, confirm file libcocos2dcpp.so installed [x86][armeabi][armeabi-v7a]
  5. Using Eclipse (from adt bundle). Import [MyProject]\proj.android
  6. Then import libcocos2dx from [MyProject]\cocos2d\cocos\2d\platform\android\java
  7. Run as Android application
    Result: file .apk has been installed but cannot be started. Here is logcat:

04-09 17:07:31.282: E/Trace(1590): error opening trace file: No such file or directory (2) 04-09 17:07:31.292: D/Cocos2dxActivity(1590): model=Android SDK built for x86 04-09 17:07:31.292: D/Cocos2dxActivity(1590): product=sdk_x86 04-09 17:07:31.292: D/Cocos2dxActivity(1590): isEmulator=true 04-09 17:07:31.292: D/dalvikvm(1590): Trying to load lib /data/data/com.testpackage1.hahaha/lib/libcocos2dcpp.so 0xb592fea0 04-09 17:07:31.292: D/dalvikvm(1590): Added shared lib /data/data/com.testpackage1.hahaha/lib/libcocos2dcpp.so 0xb592fea0 04-09 17:07:31.292: D/JniHelper(1590): JniHelper::setJavaVM(0xb99270b0), pthread_self() = -1208208320 04-09 17:07:31.302: W/dalvikvm(1590): JNI WARNING: 0xb592fea0 is not a valid JNI reference 04-09 17:07:31.302: W/dalvikvm(1590): in Lorg/cocos2dx/lib/Cocos2dxRenderer;.nativeOnResume:()V (CallObjectMethodV) 04-09 17:07:31.302: I/dalvikvm(1590): "GLThread 74" prio=5 tid=10 RUNNABLE 04-09 17:07:31.302: I/dalvikvm(1590): | group="main" sCount=0 dsCount=0 obj=0xb594c790 self=0xb9a5dfa8 04-09 17:07:31.302: I/dalvikvm(1590): | sysTid=1603 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=-1180581240 04-09 17:07:31.302: I/dalvikvm(1590): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 04-09 17:07:31.302: I/dalvikvm(1590): at org.cocos2dx.lib.Cocos2dxRenderer.nativeOnResume(Native Method) 04-09 17:07:31.302: I/dalvikvm(1590): at org.cocos2dx.lib.Cocos2dxRenderer.handleOnResume(Cocos2dxRenderer.java:149) 04-09 17:07:31.302: I/dalvikvm(1590): at org.cocos2dx.lib.Cocos2dxGLSurfaceView$3.run(Cocos2dxGLSurfaceView.java:165) 04-09 17:07:31.302: I/dalvikvm(1590): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462) 04-09 17:07:31.302: I/dalvikvm(1590): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240) 04-09 17:07:31.302: E/dalvikvm(1590): VM aborting 04-09 17:07:31.302: A/libc(1590): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 1603 (Thread-74)

I even try cocos run -s [MyProject] -p android. The Build is success, deploy success. But when i try to start app, nothing happen.

1 Like

Hi,

just do this

JniHelper::classloader = cocos2d::JniHelper::getEnv()->NewGlobalRef(_c);

in JinHelper.cpp line 146, the bug fixed!

thanks to mond03cn

to me works fine

@gleidsonsiq

Thank for your help, and to @mond03cn too. Now it’s running :). But because this problem is in library itself. Please, any experienced developer should examine this problem to identify if this is bug or not to report this to engine’s core team.