Error running the apk: Android + Box2D + Eclipse + cocos2d-x 2.2.2

Error running the apk: Android + Box2D + Eclipse + cocos2d-x 2.2.2
0.0 0


Hi all,

I’m trying to get cocos2d-x working with Box2D.

I get the following error:
02-25 23:05:45.957: E/cocos2d-x assert(16344): CCApplication.cpp function:sharedApplication line:60
02-25 23:05:45.967: A/libc(16344): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 16500 (Thread-1744)

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes $(LOCAL_PATH)/…/…/…/…/external/Box2D

LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static


$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)

APP_STL := gnustl_static

I have added the following code into HelloWorldScene.cpp:

b2CircleShape circle;
circle.m_radius = 26.0/PTM_RATIO;

Any help would be nice, since I can’t seem to find a proper answer on how to add Box2D properly to 2.2.2 cocos-2dx. Some articles contain older cocos2dx version, which seem not relevant anymore.



Have you checked the TestCpp samples? There is a Box2D test.


Just tested it. I have exact the same error. I have imported cocos2dx/platform/java as eclipse project, rebuilt everything and when debugging, I get the same crash.


@morrowyn Try to copy the java src files into the project. You could refer to for more information.


Thanks for the help. I fixed the problem. I had to add cocos2dx android project to the Android Build Path. However when the phonescreen is off and I try to run it i get the following (ndk-stack):

Build fingerprint: 'samsung/jfltexx/jflte:4.2.2/JDQ39/I9505XXUAMDE:user/release-keys’
pid: 9846, tid: 10018, name: Thread-2346 >>> org.cocos2dx.testcpp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00 pc 0036c08a /data/app-lib/org.cocos2dx.testcpp-1/ (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause+5): Routine Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause in /Users/izzy1/Development/SDK/cocos2d-x-2.2.2/samples/Cpp/TestCpp/…/…/…/…/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp:18
Stack frame #01 pc 0001eb0c /system/lib/ (dvmPlatformInvoke+112)
Stack frame #02 pc 0004f457 /system/lib/ (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
Stack frame #03 pc 00050e45 /system/lib/ (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+184)
Stack frame #04 pc 00027fe4 /system/lib/
Stack frame #05 pc 00062a3c *

Btw, to get Box2D working, you need to disable Chipmunk:

APP_STL := gnustl_static