cocos2dX 2.0 lua to Android error

Hello,everyone.When I had write a project,and I had run success at Xcode.Now I want to remove it to android. So I do this

  1. remove the $COCOS2D_ROOT/lua/proj.android to myproject/libs/lua
  2. Change the proj.android/jni/Android.mk to this

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

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

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_lua_static

include $(BUILD_SHARED_LIBRARY)

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

$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx) $(call import-module,lua/proj.android/jni)

And the error msg is

StaticLibrary : liblua.a
SharedLibrary : libgame.so
./obj/local/armeabi/libcocos2d.a(CCConfiguration.o): In function `cocos2d::CCConfiguration::init()‘:
/Users/zhaozhongjian/Documents/tools/cocos2d-2/cocos2dx/CCConfiguration.cpp:65: undefined reference to `std::allocator::allocator()’
/Users/zhaozhongjian/Documents/tools/cocos2d-2/cocos2dx/CCConfiguration.cpp:65: undefined reference to `std::basic_string<char, std::char_traits, std::allocator >::basic_string(char const*, std::allocator const&)‘
/Users/zhaozhongjian/Documents/tools/cocos2d-2/cocos2dx/CCConfiguration.cpp:65: undefined reference to `std::basic_string<char, std::char_traits, std::allocator >::basic_string’
/Users/zhaozhongjian/Documents/tools/cocos2d-2/cocos2dx/CCConfiguration.cpp:65:\ undefined\ reference\ to\ `std::allocator::
allocator()’

and so on.
I do not know how solve it.Help me ,thank you.


屏幕快照 2012-07-19 上午10.41.53.png (37.8 KB)


屏幕快照 2012-07-19 上午10.41.53.png (37.8 KB)

Can someone help me? Thank you.

阁下是中国人吧,我就用汉语回了,英语实在太垃圾。
我初步怀疑是
LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes
并没有加入所有的.h文件,对否?

额 那我也用汉语吧 英语也实在太垃圾了。。。

LOCAL_C_INCLUDES 还要包含哪些头文件呢? lua 我个人感觉应该是作为一个库文件打包进去了。。所以任何文件都没引。。望您在详细的解释下。。菜鸟一个 呵呵 谢谢。

Hello,Anyone. Help.

What’s the content of Application.mk?
The content should be

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti

Minggo Zhang
Yes.My Application.mk’s content is that.
And I had success build the HelloLua to the Android. Then I copy the proj.android folder to my project. But failed.
Then I copy the content of the jin/Android.mk to mine.But it failed,again.
Can you help me?

Hello everyone, Help me.
My proj.android/jni/Android.mk looks like this

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES = cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES
= cocos_lua_static

include $(BUILD_SHARED_LIBRARY)

LOCAL_SRC_FILES := helloworld/main.cpp …/…/Classes/AppDelegate.cpp …/…/…/lua/cocos2dx_support/CCLuaEngine.cpp …/…/…/lua/cocos2dx_support/Cocos2dxLuaLoader.cpp …/…/…/lua/cocos2dx_support/LuaCocos2d.cpp …/…/…/lua/cocos2dx_support/tolua_fix.c

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

$(call import-module,cocos2dx)
$(call import-module,CocosDenshion/android)
$(call import-module,lua/proj.android/jni)

and my Application.mk looks like this

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti

and the error message is also the same.

Can someone help me?

Please use create-android-project.sh or create-android-project.bat to create a new android project.
More information please refer [[How to create android project with script]].

Yes,I create the project use the script.

Could you paste .cpp files to reproduce it?

My step is that:

  1. create an Android project by script.
    2.copy the proj.android folder , platform folder, cocos2d/Android.mk , cocosDesion/android folder, lua/ folder to my project
    3.change the build_native.sh
    4.change the proj.android/Android.mk file. copy the HelloLua/jni/Android.mk to my project.

Sorry, I do not understand you. Which .cpp file?

Could you paste a demo project to reproduce it?
Or you can send a zip file to me.

OK,Thank you. I will send your the zip file.

try delete .o files.
it’s under

proj.android\obj\local\armeabi