How to setup chipmunk to new android app? I am using latest cocos2d-x 2.1.2 version

How to setup chipmunk to new android app? I am using latest cocos2d-x 2.1.2 version

I have the app runs on both android and ios. On iOS, I just add the chipmunks source code to the xcode project, everything works fine.

but for android project, I have set up the jni/Android.mk file like this

LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes $(LOCAL_PATH)/…/…/Classes/NDKHelper $(LOCAL_PATH)/…/…/Classes/jansson
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES = cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES
= cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static

include $(BUILD_SHARED_LIBRARY)

$(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/chipmunk)

when I run from eclipes, the app compiled and crashes on android device.

The error message I got from LogCat is:
Fatal signal 11 (SIGSEGV) at 0x73690950 (code=1), thread 29415 (Thread-9566)

Emmy Chen wrote:

How to setup chipmunk to new android app? I am using latest cocos2d-x 2.1.2 version
>
I have the app runs on both android and ios. On iOS, I just add the chipmunks source code to the xcode project, everything works fine.
>
but for android project, I have set up the jni/Android.mk file like this
>
LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes > $(LOCAL_PATH)/…/…/Classes/NDKHelper > $(LOCAL_PATH)/…/…/Classes/jansson >
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES = cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES
= cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
>
>
include $(BUILD_SHARED_LIBRARY)
>
$(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/chipmunk)
>
when I run from eclipes, the app compiled and crashes on android device.
>
The error message I got from LogCat is:
Fatal signal 11 (SIGSEGV) at 0x73690950 (code=1), thread 29415 (Thread-9566)

I found it harder to set up android compared to iOS too.
That log line alone doesn’t really mean much except ‘the app crashed’. Please post more of the log before that line. If there’s no log output of errors you may have to debug/get a stacktrace and post it.

I tracked down the problem. It crashes at update(float delta)

void ABCTappingLayer::update(float delta)
{
// Should use a fixed size step based on the animation interval.
int steps = 2;
float dt = CCDirector::sharedDirector()->getAnimationInterval()/(float)steps;
for(int i=0; i<steps; i++){
cpSpaceStep(m_pSpace, dt); //// crashes at here.
}
}

Any idea about this?

Emmy
Michael Chinen wrote:

Emmy Chen wrote:
> How to setup chipmunk to new android app? I am using latest cocos2d-x 2.1.2 version
>
> I have the app runs on both android and ios. On iOS, I just add the chipmunks source code to the xcode project, everything works fine.
>
> but for android project, I have set up the jni/Android.mk file like this
>
> LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes
$(LOCAL_PATH)/…/…/Classes/NDKHelper
$(LOCAL_PATH)/…/…/Classes/jansson
>
> LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
> LOCAL_WHOLE_STATIC_LIBRARIES = cocosdenshion_static
> LOCAL_WHOLE_STATIC_LIBRARIES
= cocos_extension_static
> LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
>
>
> include $(BUILD_SHARED_LIBRARY)
>
> $(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/chipmunk)
>
> when I run from eclipes, the app compiled and crashes on android device.
>
> The error message I got from LogCat is:
> Fatal signal 11 (SIGSEGV) at 0x73690950 (code=1), thread 29415 (Thread-9566)
>
I found it harder to set up android compared to iOS too.
That log line alone doesn’t really mean much except ‘the app crashed’. Please post more of the log before that line. If there’s no log output of errors you may have to debug/get a stacktrace and post it.

I solved the problem. I did not define CC_ENABLE_CHIPMUNK_INTEGRATION in Application.mk. Once I added CC_ENABLE_CHIPMUNK_INTEGRATION to Application.mk, everything works fine on Android. :slight_smile:

Emmy Chen wrote:

I tracked down the problem. It crashes at update(float delta)
>
void ABCTappingLayer::update(float delta)
{
// Should use a fixed size step based on the animation interval.
int steps = 2;
float dt = CCDirector::sharedDirector()->getAnimationInterval()/(float)steps;
for(int i=0; i<steps; i++){
cpSpaceStep(m_pSpace, dt); //// crashes at here.
}
}
>
Any idea about this?
>
Emmy
Michael Chinen wrote:
> Emmy Chen wrote:
> > How to setup chipmunk to new android app? I am using latest cocos2d-x 2.1.2 version
> >
> > I have the app runs on both android and ios. On iOS, I just add the chipmunks source code to the xcode project, everything works fine.
> >
> > but for android project, I have set up the jni/Android.mk file like this
> >
> > LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes
> $(LOCAL_PATH)/…/…/Classes/NDKHelper
> $(LOCAL_PATH)/…/…/Classes/jansson
>
> > LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
> > LOCAL_WHOLE_STATIC_LIBRARIES = cocosdenshion_static
> > LOCAL_WHOLE_STATIC_LIBRARIES
= cocos_extension_static
> > LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
> >
> >
> > include $(BUILD_SHARED_LIBRARY)
> >
> > $(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/chipmunk)
> >
> > when I run from eclipes, the app compiled and crashes on android device.
> >
> > The error message I got from LogCat is:
> > Fatal signal 11 (SIGSEGV) at 0x73690950 (code=1), thread 29415 (Thread-9566)
>
> I found it harder to set up android compared to iOS too.
> That log line alone doesn’t really mean much except ‘the app crashed’. Please post more of the log before that line. If there’s no log output of errors you may have to debug/get a stacktrace and post it.