Can't build HelloWorld using build_native.sh (Snow Leopard)

Hi folks,

I’m using Android-NDK r6b (http://dl.google.com/android/ndk/android-ndk-r6b-darwin-x86.tar.bz2) and cocos2d-1.0.1-x-0.12.0.

Also, I am using OS X, in case it’s relevant.

  1. I can run/compile NDK tests in emulator fine
  2. I can run SDK-related tests in emulator fine

Here’s what happens when I try ./build_native.sh for the HelloWorld
Chris/workspace/cocos2d-x/HelloWorld/android$\ ./build_native.sh
/workspace/android-ndk-r6b ~/workspace/cocos2d-x/HelloWorld/android
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Install : libcocosdenshion.so => libs/armeabi/libcocosdenshion.so
Compile++ thumb : cocos2dx_static <= TouchesJni.cpp
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/platform/android/jni/TouchesJni.cpp: In function ‘void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin(JNIEnv**, _jobject**, jint, jfloat, jfloat)’:
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/platform/android/jni/TouchesJni.cpp:62: error: no matching function for call to ‘cocos2d::CCTouch::SetTouchInfo(jfloat, jfloat, jint&)’
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/include/CCTouch.h:42: note: candidates are: void cocos2d::CCTouch::SetTouchInfo(float, float)
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/platform/android/jni/TouchesJni.cpp: In function ‘void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv**, _jobject**, jint, jfloat, jfloat)’:
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/platform/android/jni/TouchesJni.cpp:86: error: no matching function for call to ‘cocos2d::CCTouch::SetTouchInfo(jfloat, jfloat, jint&)’
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/include/CCTouch.h:42: note: candidates are: void cocos2d::CCTouch::SetTouchInfo(float, float)
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/platform/android/jni/TouchesJni.cpp: In function ’void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv**, _jobject**, jintArray*, _jfloatArray**,jfloatArray*)‘:
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/platform/android/jni/TouchesJni.cpp:119: error: no matching function for call to ’cocos2d::CCTouch::SetTouchInfo(jfloat, jfloat, jint&)’
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/include/CCTouch.h:42: note: candidates are: void cocos2d::CCTouch::SetTouchInfo
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/platform/android/jni/TouchesJni.cpp: In function ’void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel‘:
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/platform/android/jni/TouchesJni.cpp:152: error: no matching function for call to ’cocos2d::CCTouch::SetTouchInfo(jfloat, jfloat, jint&)’
/Users/Chris/workspace/cocos2d-x/HelloWorld/android/jni/…/…/…/cocos2dx/include/CCTouch.h:42: note: candidates are: void cocos2d::CCTouch::SetTouchInfo
make:***** Error 1
~/workspace/cocos2d-x/HelloWorld/android@
So, it builds libs/armeabi/libcocosdenshion.so… but thats all… I know I need to be compiling several others. Not sure why it builds partially?
**Here is my Android.mk from /cocos2d-x/HelloWorld/android/jni/helloworld/Android.mk*
`LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := helloworld_shared

LOCAL_MODULE_FILENAME := libhelloworld

LOCAL_SRC_FILES := main.cpp

LOCAL_STATIC_LIBRARIES := png_static_prebuilt
LOCAL_STATIC_LIBRARIES += xml2_static_prebuilt
LOCAL_STATIC_LIBRARIES += jpeg_static_prebuilt
LOCAL_WHOLE_STATIC_LIBRARIES := game_logic_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static

LOCAL_SHARED_LIBRARIES := cocosdenshion_shared

include $(BUILD_SHARED_LIBRARY)

$(call import-module,cocos2dx/platform/third_party/android/modules/libpng)
$(call import-module,cocos2dx/platform/third_party/android/modules/libxml2)
$(call import-module,cocos2dx/platform/third_party/android/modules/libjpeg)`

Here are build_native.sh params
# set params NDK_ROOT_LOCAL=/Users/Chris/workspace/android-ndk-r6b COCOS2DX_ROOT_LOCAL=/Users/Chris/workspace/cocos2d-x

Any ideas on my problem? Please excuse if my formatting isn’t well, first post on this forum :slight_smile:

i can get ./build_native.sh to work when I comment out setTouchInfo* method calls insidecocos2dx/platform/android/jni/TouchesJni.cpp*

This is super hackjobish though, I wouldn’t consider it an acceptable solution. Plus I am sure it will have consequences once I run the app.

Still open for suggestions/ideas on what I may be doing wrong

Okay, it looks like SetTouchInfo(float, float) was being passed an extra parameter from TouchesJni.cpp (as the logs indicate). As a solution, I added the extra parameter to the declaration/definition in cocos2dx/include/CCTouch.h/m.
After that, I was able to do everything ok.
I am wondering if there any alternatives to this approach?

Oh, did you use the latest code on git?
Please use released version.