1.编译过程中 将warnning 认定为error,修改方法试了很多种
1)find . -name 'Application.mk' |xargs sed -i '1i APP_CPPFLAGS += -Wno-error=format-security' #在所有Application.mk文件中添加一句话APP_CPPFLAGS += -Wno-error=format-security,这个是在很多国外网站上看到的,但实际还是报错,出错原因是把 unsigned int 转化成了 long unsigned int,%ui --> %lu ,把相应文件的 lu全部改为ui后编译顺利通过
2.编译helloCpp的时候出错,大致为:
Using auto-detected project path: .
Found package name: org.cocos2dx.hellocpp
jni/Android.mk:19: *** Android NDK: Aborting. 。 停止。
ABIs targetted by application: Android NDK: WARNING: Ignoring unknown import directory: /home/wyl/work/tools/cocos2d-x/cocos2d-x-3.0alpha1/cocos/cocos2dx/platform/third_party/android/prebuilt
Android NDK: jni/Android.mk: Cannot find module with tag 'cocos2dx' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
Device API Level: 16
Device CPU ABIs: armeabi-v7a armeabi
ERROR: The device does not support the application's targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports: Android NDK: WARNING: Ignoring unknown import directory: /home/wyl/work/tools/cocos2d-x/cocos2d-x-3.0alpha1/cocos/cocos2dx/platform/third_party/android/prebuilt
Android NDK: jni/Android.mk: Cannot find module with tag 'cocos2dx' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
解决方法:export COCOS2DX_ROOT=/home/wyl/work/tools/cocos2d-x/cocos2d-x-2.2.1 路径设置出错,之前用的3.0 alpha,还有许多bug未修复,改成2.2后编译通过
3.继续编译还是出错:
ERROR: Package org.cocos2dx.hellocpp is not debuggable ! You can fix that in two ways:
- Rebuilt with the NDK_DEBUG=1 option when calling 'ndk-build'.
- Modify your manifest to set android:debuggable attribute to "true",
then rebuild normally.
After one of these, re-install to the device!
解决方法:在Androidmanifest.xml中添加 android:debuggable="true"
<application android:label="@string/app_name"
android:debuggable="true"
android:icon="@drawable/icon">
4.继续出错:
Found debuggable flag: true
ERROR: Could not find gdbserver binary under ./libs/armeabi
This usually means you modified your AndroidManifest.xml to set
the android:debuggable flag to 'true' but did not rebuild the
native binaries. Please call 'ndk-build' to do so,
*then* re-install to the device!
5.ndk 编译出错:
undefined reference to `__gnu_thumb1_case_si 更换为r9后ok
6.将“adb_var_shell2 DATA_DIR run-as $PACKAGE_NAME /system/bin/sh -c pwd”用DATA_DIR="/data/data/$PACKAGE_NAME" 替换