Exception updating game to cocos2d-x v2.0

3

I'm working on linux + eclipse.

I have updated my code following the steps provided by the wiki.

1º I create a new eclipse project. 2º I run hello world and it works. 3º I put my old code on Classes, and resources. 4º I update appdelegate.cpp .h, and jni/Android.mk with new files. 5º It compile correctly.

6º Lauching from eclipse i get the following exception:

trying to load lib /data/data/org.pipero.game/lib/libgame.so
Fatal signal 11.

Something is wrong, but i don't know what is happening.

The same code work on a xcode project.
I don't get the CCLOG message con Appdelegate constructor, and on Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit on main.cpp neither.

LOGCAT:

---- LOG TEST RUNNING HELLO WORLD ------
06-13 18:29:07.189: D/dalvikvm(11613): Trying to load lib /data/data/pipero.corporation.nyan/lib/libgame.so 0x40f87190
06-13 18:29:07.199: D/dalvikvm(11613): Added shared lib /data/data/pipero.corporation.nyan/lib/libgame.so 0x40f87190
06-13 18:29:07.269: W/apk path(11613): /data/app/pipero.corporation.nyan-2.apk
06-13 18:29:07.409: D/SurfaceView(11613): pckname = pipero.corporation.nyan
06-13 18:29:07.809: D/libEGL(11613): loaded /system/lib/egl/libGLES_android.so
06-13 18:29:07.859: D/libEGL(11613): loaded /system/lib/egl/libEGL_mali.so
06-13 18:29:07.919: D/libEGL(11613): loaded /system/lib/egl/libGLESv1_CM_mali.so
06-13 18:29:07.929: D/libEGL(11613): loaded /system/lib/egl/libGLESv2_mali.so
------------------------------------- OK -------------------------------

---- LOG TEST RUNNING TEST changing android files to mine ------
06-13 18:36:31.789: D/dalvikvm(12046): Trying to load lib /data/data/pipero.corporation.nyan/lib/libgame.so 0x40f8de18
06-13 18:36:31.799: A/libc(12046): Fatal signal 11 (SIGSEGV) at 0x00000030 (code=1)
--------------------------------------- FAIL --------------------------

I have try to compile in another tablet (An Android 3.2) And i getting the same problem. This time the log is:

06-12 15:16:16.610: I/DEBUG: * * 06-12 15:16:16.610: I/DEBUG: Build fingerprint: 'asus/WW_epad/TF101:3.2.1/HTK75/WW_epad-8.6.5.13-20110925:user/release-keys' 06-12 15:16:16.610: I/DEBUG: pid: 1183, tid: 1183 >>> pipero.corp.test

So, signal 11 SEGV_MAPERR, i assume that is a problem with the compilation, the library is found, but the program cannot load it correctly. The JNI not execute jni_Onload.

Some idea???

Thanks in advance.

android
java-native-interface
shared-libraries
cocos2d-x
asked on Stack Overflow Jun 7, 2012 by vgonisanz • edited Jun 13, 2012 by vgonisanz

2 Answers

3

Inside your project folder, double check that the lib file is actually inside your android libs folder.

[cocos2d-x root]/[game_name]/android/libs

There should be one file called libgame.so inside there.

If it compiles ok, the .so file should be generated. When you compile, I find it helpful to "Refresh" the project in eclipse so that eclipse rescans the directories for any new files/modifications to pack into the APK file for deploying.

There is an option you can enable in eclipse to automatically detect file system changes I believe, but I'm not sure where that options is.

answered on Stack Overflow Jun 11, 2012 by irwinb
3

As you are getting fatal signal 11 maybe you want to have a look at this. It is a segmentation fault, accessing a memory location that was not assigned, usually due to a programing bug.

Good luck, but as some people have no problems with the new version the most likely case is that you have a programing bug that with the old version was not giving problems.

answered on Stack Overflow Jun 19, 2012 by Jav_Rock

User contributions licensed under CC BY-SA 3.0