I have Merged the Android project into the iPhone project under the director http://gameit.ro/2011/08/creating-an-iphone-and-android-cocos2d-x-hybrid-project/
and build it and get this wrong.
/software/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/…/lib/gcc/arm-linux-androideabi/4.4.3/…/…/…/…/arm-linux-androideabi/bin/ld: cannot find ~~lpng
collect2: ld returned 1 exit status
make: * Error 1
jni/Android.mk
`LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
subdirs := $(addprefix $(LOCAL_PATH)/…/…/libs/,$(addsuffix /Android.mk,
cocos2dx
CocosDenshion/android
))
subdirs += $(LOCAL_PATH)/helloworld/Android.mk
include $(subdirs)`
helloworl/Android.mk
@
LOCAL_PATH := $
include $
LOCAL_MODULE := game
LOCAL_SRC_FILES := main.cpp …/…/…/Classes/AppDelegate.cpp …/…/…/Classes/HelloWorldScene.cpp
LOCAL_C_INCLUDES := $/…/…/…/libs/cocos2dx $/…/…/…/libs/cocos2dx/platform $/…/…/…/libs/cocos2dx/include $/…/…/…/libs/CocosDenshion/include $/…/…/…/Classes
# it is used for ndk-r5
# if you build with ndk-r4, comment it
# because the new Windows toolchain doesn’t support Cygwin’s drive
# mapping
LOCAL_LDLIBS :=~~L$(call host-path, $(LOCAL_PATH)/…/…/libs/armeabi) lcocos2d llog ~~lcocosdenshion ~~L$(call host-path, $(LOCAL_PATH)/…/…/…/libs/cocos2dx/platform/third_party/android/libraries) -lcurl
include $(BUILD_SHARED_LIBRARY)
@
work directory arch
test
|--libs
|--cocos2dx
|--cocsDenshion
|--android
|--ios
|--Classes
|--Resources
zhangxm
September 7, 2011, 9:46pm
#2
What’s your version of cocos2d-x? You should paste cocos2dx/Android.mk.
cocos2d-1.0.1-x-0.9.1
cocos2dx/Android.mk
LOCAL_PATH := $(call my-dir)
# compile cocos2d.so
include $(CLEAR_VARS)
LOCAL_MODULE := libcocos2d
LOCAL_SRC_FILES := \
CCConfiguration.cpp \
CCDrawingPrimitives.cpp \
CCScheduler.cpp \
CCCamera.cpp \
actions/CCAction.cpp \
actions/CCActionCamera.cpp \
actions/CCActionEase.cpp \
actions/CCActionGrid.cpp \
actions/CCActionGrid3D.cpp \
actions/CCActionInstant.cpp \
actions/CCActionInterval.cpp \
actions/CCActionManager.cpp \
actions/CCActionPageTurn3D.cpp \
actions/CCActionProgressTimer.cpp \
actions/CCActionTiledGrid.cpp \
base_nodes/CCAtlasNode.cpp \
base_nodes/CCNode.cpp \
cocoa/CCAffineTransform.cpp \
cocoa/CCGeometry.cpp \
cocoa/CCAutoreleasePool.cpp \
cocoa/CCData.cpp \
cocoa/CCNS.cpp \
cocoa/CCObject.cpp \
cocoa/CCSet.cpp \
cocoa/CCZone.cpp \
cocos2d.cpp \
CCDirector.cpp \
effects/CCGrabber.cpp \
effects/CCGrid.cpp \
keypad_dispatcher/CCKeypadDelegate.cpp \
keypad_dispatcher/CCKeypadDispatcher.cpp \
label_nodes/CCLabelAtlas.cpp \
label_nodes/CCLabelBMFont.cpp \
label_nodes/CCLabelTTF.cpp \
layers_scenes_transitions_nodes/CCLayer.cpp \
layers_scenes_transitions_nodes/CCScene.cpp \
layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp \
layers_scenes_transitions_nodes/CCTransitionRadial.cpp \
layers_scenes_transitions_nodes/CCTransition.cpp \
menu_nodes/CCMenu.cpp \
menu_nodes/CCMenuItem.cpp \
misc_nodes/CCMotionStreak.cpp \
misc_nodes/CCProgressTimer.cpp \
misc_nodes/CCRenderTexture.cpp \
misc_nodes/CCRibbon.cpp \
particle_nodes/CCParticleExamples.cpp \
particle_nodes/CCParticleSystem.cpp \
particle_nodes/CCParticleSystemPoint.cpp \
particle_nodes/CCParticleSystemQuad.cpp \
platform/CCFileUtils.cpp \
platform/CCGL.cpp \
platform/CCImage.cpp \
platform/CCStdC.cpp \
platform/CCSAXParser.cpp \
platform/CCThread.cpp \
platform/CCCommon.cpp \
platform/platform.cpp \
platform/android/CCEGLView_android.cpp \
platform/android/CCAccelerometer_android.cpp \
platform/android/CCApplication_android.cpp \
platform/android/jni/JniHelper.cpp \
platform/android/jni/IMEJni.cpp \
platform/android/jni/MessageJni.cpp \
platform/android/jni/SensorJni.cpp \
platform/android/jni/SystemInfoJni.cpp \
platform/android/jni/TouchesJni.cpp \
script_support/CCScriptSupport.cpp \
sprite_nodes/CCAnimation.cpp \
sprite_nodes/CCAnimationCache.cpp \
sprite_nodes/CCSprite.cpp \
sprite_nodes/CCSpriteBatchNode.cpp \
sprite_nodes/CCSpriteFrame.cpp \
sprite_nodes/CCSpriteFrameCache.cpp \
support/CCArray.cpp \
support/CCProfiling.cpp \
support/CCPointExtension.cpp \
support/TransformUtils.cpp \
support/CCUserDefault.cpp \
support/base64.cpp \
support/ccUtils.cpp \
support/image_support/TGAlib.cpp \
support/zip_support/ZipUtils.cpp \
support/zip_support/ioapi.cpp \
support/zip_support/unzip.cpp \
text_input_node/CCIMEDispatcher.cpp \
text_input_node/CCTextFieldTTF.cpp \
textures/CCTexture2D.cpp \
textures/CCTextureAtlas.cpp \
textures/CCTextureCache.cpp \
textures/CCTexturePVR.cpp \
tileMap_parallax_nodes/CCParallaxNode.cpp \
tileMap_parallax_nodes/CCTMXLayer.cpp \
tileMap_parallax_nodes/CCTMXObjectGroup.cpp \
tileMap_parallax_nodes/CCTMXTiledMap.cpp \
tileMap_parallax_nodes/CCTMXXMLParser.cpp \
tileMap_parallax_nodes/CCTileMapAtlas.cpp \
touch_dispatcher/CCTouchDispatcher.cpp \
touch_dispatcher/CCTouchHandler.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/platform \
$(LOCAL_PATH)/platform/third_party/android/iconv \
$(LOCAL_PATH)/platform/third_party/android/libpng \
$(LOCAL_PATH)/platform/third_party/android/libxml2 \
$(LOCAL_PATH)/platform/third_party/android/libjpeg
# it is used for ndk-r5
# if you build with ndk-r4, comment it
# because the new Windows toolchain doesn't support Cygwin's drive
# mapping (i.e /cygdrive/c/ instead of C:/)
LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/libraries) \
-lGLESv1_CM -llog -lz \
-lpng \
-lxml2 \
-ljpeg
# define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS := -DUSE_FILE32API
include $(BUILD_SHARED_LIBRARY)
zhangxm
September 8, 2011, 12:23am
#4
It seems not problem there. Can HelloWorld compiled ok with ndk-r6 on your environment?
yes the tests compiled ok and i copy the files third_party/android/libraries/* to ndk lib directory it compile ok too.
how can i echo “LOCAL_LDLIBS” params to see the value
zhangxm
September 8, 2011, 2:52am
#6
It is strange, if you create the project by xcode template, it will copy all contents of cocos2dx including third_party/android/libraries/* into libs/cocos2dx.
You can not use echo to print the message, may be you can refer
http://groups.google.com/group/android-ndk/browse_thread/thread/2b31984063c365d
It says that you can use $(warning ) to print messages.
L /Users/taoyinqing/Program/android/cocos2d-x/cocos2d-1.0.1-x-0.9.1/test/android/jni/…/…/libs/cocos2dx/platform/third_party/android/libraries lGLESv1_CM llog lz lpng lxml2 -ljpeg
the path is right
I change the LOCAL_LDLIBS to this it compile ok
LOCAL_LDLIBS := -L"$(LOCAL_PATH)/platform/third_party/android/libraries" \
-lGLESv1_CM -llog -lz \
-lpng \
-lxml2 \
-ljpeg