Cocos2d-x 3.2编译生成Android程序出错的解决方案:c++_static报错
最近升级到Cocos2d-x 3.2正式版,iOS程序编译没任何问题,结果使用cocos compile -p android编译生成APK程序,结果悲剧了,出现以下错误。
Android NDK: Invalid APP_STL value: c++_static
Android NDK: Please use one of the following instead: system stlport_static stlport_static_hard stlport_shared stlport_shared_hard gnustl_static gnustl_shared gabi++_static gabi++_shared libc++_static libc++_shared none
make: Entering directory `/game/physics_engine/proj.android‘
/sdk/ndk/android-ndk-r9c/build/core/add-application.mk:274: *** Android NDK: Aborting . Stop.
make: Leaving directory `/game/physics_engine/proj.android‘
Error running command, return code: 2
很显然,这个错误是使用了不正确的STL Library,解决方案有如下两个。
方案1:临时方案
修改Application.mk文件,将原来的前4行替换为如下的内容。然后替换就ok了
原来的内容如下:
APP_STL := c++_static
NDK_TOOLCHAIN_VERSION=clang
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic
替换后的内容如下:
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix -fsigned-char
方案2:
由于c++_static只有在最新的NDK中才可使用,所以下载最新的NDK就可以了
大家可以从http://developer.android.com/tools/sdk/ndk/index.html下载最新的NDK版本,然后从新设置ndk路径即可。
转自:http://www.bubuko.com/infodetail-344135.html
更多相关文章
- G1定制攻略
- android presentation实现双屏异显
- 反编译apk文件,得到其源代码和资源的方法
- android 6.0 动态权限解决方案
- 在Linux下adb连接不上android手机的终极解决方案
- Android(安卓)即时音视频解决方案1——环信
- Could not resolve all files for configuration ':classpath'.
- 如何进行adb模式下的调试
- 报错 Error:Could not install Gradle distribution from 'https