Box2d in cocos2dx 2.0 android project

Hi,

I really need some help with android project setup. Everything works when I am not using Box2d in the project. Here is what I’ve done so far:

  1. I followed the http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started tutorial
  2. In the tutorial above I added the -b option to create-android-project.sh script

Now, when I am trying to include Box2D.h in HelloWorldScene I get the No such file or directory error.

My mk file is as follows:

///////////////////////////////////////////////////////////////
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

LOCAL_SRC_FILES := helloworld/main.cpp …/…/Classes/AppDelegate.cpp …/…/Classes/HelloWorldScene.cpp

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

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static box2d_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx) $(call import-module,Box2D)
///////////////////////////////////////////////////////////////

It would be very nice if someone could provide a step-by-step guide on how to setup cocos2dx android project with Box2D.

BR,
Marcin

I found the solution.

If I use:

#include “Box2D/Box2D.h”

instead of

#include “Box2D.h”

it works on both: Android and iPhone.

Any explenations are welcome.

Marcin

I’m having the same problem as you and I’m trying to declare a b2World, but when I write
Box2D::b2World* world; my game wont compile.