Hello,
I wrote small game in VS 2010 for win32 and now want to run this game on android.
I successfully compiled native code with build_native.sh, but my libs are different from all I’ve seen in other posts. I used “ndk-r7c” and “cocos2d-1.0.1-x-0.12.0”.
My libs have postfix and are not same.
There are “cocos2dx_static”, “cocosdenshion_shared”, “box2d_shared” and “game_shared”. For example, as You can see, cocos2dx lib is static.
So, I’ve “libcocosdenshion.so”, “libbox2d.so” and “libgame.so” only.
I’ve changed files and they are ( Old code generators generates not same code in “Android.mk” files as my. At forum all have cocos2dx lib in “libs/armeabi”, instead me, for example ) :
jni/Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
subdirs := $(addprefix $(LOCAL_PATH)/…/…/,$(addsuffix /Android.mk, Box2D …/cocos2dx …/CocosDenshion/android ))
subdirs = $/…/…/Classes/Android.mk $/helloworld/Android.mk
include $
jni/Application.mk:
APP_STL := gnustl_static
APP_CPPFLAGS= frtti error occurs.
APP_MODULES := cocos2dx_static cocosdenshion_shared box2d_shared game_shared
jni/helloworld/Android.mk:
LOCAL_PATH := $
include $
LOCAL_MODULE := game_shared
LOCAL_MODULE_FILENAME := libgame
LOCAL_SRC_FILES := main.cpp
LOCAL_C_INCLUDES := $/…/…/…/Classes/Singletons
LOCAL_STATIC_LIBRARIES := png_static_prebuilt
LOCAL_STATIC_LIBRARIES = xml2_static_prebuilt
LOCAL_STATIC_LIBRARIES= jpeg_static_prebuilt
LOCAL_STATIC_LIBRARIES = curl_static_prebuilt
LOCAL_WHOLE_STATIC_LIBRARIES := game_logic_static
LOCAL_WHOLE_STATIC_LIBRARIES= cocos2dx_static
LOCAL_SHARED_LIBRARIES := box2d_shared
LOCAL_SHARED_LIBRARIES = cocosdenshion_shared
include $
$
$
$
$
Classes/Android.mk:
LOCAL_PATH := $
include $
LOCAL_MODULE := game_logic_static
LOCAL_MODULE_FILENAME := libgame_logic
LOCAL_SRC_FILES := /*
There are many source code files
*/
LOCAL_C_INCLUDES := $/…
LOCAL_EXPORT_C_INCLUDES := $/…
LOCAL_STATIC_LIBRARIES := png_static_prebuilt
LOCAL_STATIC_LIBRARIES= xml2_static_prebuilt
LOCAL_STATIC_LIBRARIES = jpeg_static_prebuilt
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_SHARED_LIBRARIES := box2d_shared
LOCAL_SHARED_LIBRARIES= cocosdenshion_shared
include $
$
$
$
All libs are connected.
But when, I’ve tried to launch my game
Can You advice solution?
my loader.java file contain:
static {
System.loadLibrary(“libcocosdenshion”);
System.loadLibrary(“libbox2d”);
System.loadLibrary(“libgame”);
}
( I don’t know, but I can’t answer you directly? because I answer there )
Minggo Zhang,
all libs are included into apk.
I finded solution. “loader.java” must contain:
static {
System.loadLibrary(“box2d”);
System.loadLibrary(“cocosdenshion”);
System.loadLibrary(“game”);
}
( Without using “lib” prefix. But file’s names contain it. )
Thanks,
Dmitry Malyuga.