【已解决】cocos2dx-3.2rc 生成 android apk问题

创建项目成功了.

并且我想生成 安卓的 apk文件的时候出现了 错误

Error running command, return code: 2

这是怎么回事. 蛋疼死了. 配置一个真麻烦那

建议把代码贴出来。

Running command: compile
Building mode: debug
building native
NDK build mode: debug
The Selected NDK toolchain version was 4.8 !
running: ‘F:\tools\adt\ndk\ndk-build -C F:\abc\mygame\frameworks\runtime-src\proj.android -j4 NDK_MODULE_PATH=F:\abc\mygame\frameworks\runtime-src\proj.android…/…/cocos2d-x;F:\abc\mygame\frameworks
\runtime-src\proj.android…/…/cocos2d-x/cocos/;F:\abc\mygame\frameworks\runtime-src\proj.android…/…/cocos2d-x/external;F:\abc\mygame\frameworks\runtime-src\proj.android…/…/cocos2d-x/cocos/scri
pting NDK_DEBUG=1’

Android NDK: Invalid APP_STL value: c++_static
Android NDK: Please use one of the following instead: system stlport_static stlport_shared gnustl_static gnustl_shared gabi++_static gabi++_shared libc++_static libc++_shared none
make.exe: Entering directory F:/abc/mygame/frameworks/runtime-src/proj.android' F:/tools/adt/ndk/build/core/add-application.mk:253: *** Android NDK: Aborting . Stop. make.exe: Leaving directory F:/abc/mygame/frameworks/runtime-src/proj.android’
Error running command, return code: 2

我的环境生成3.1没有问题

更新一下NDK,R9D以上

我也遇到这个问题,同求解决方法

请使用ndk r9d之间,还不支持ndk r10。
目测楼主用了ndk r10

看你的环境应该是低于NDK r9d。
请使用NDK r9d。
NDK r10暂不支持,正在解决。

R8,R10都试过 R8不行 R10说是命令行过长.
看来只能用R9了…

多谢指点

我用NDK r9d遇到这个问题:
E:\work\Eclipse\workspace\DefendEmpire>cocos run -p android -j 4
Running command: compile
Building mode: debug
building native
NDK build mode: debug
The Selected NDK toolchain version was 4.8 !
running: ‘D:\ProgramFiles\android-ndk-r9d\ndk-build -C E:\work\Eclipse\workspace
\DefendEmpire\frameworks\runtime-src\proj.android -j4 NDK_MODULE_PATH=E:\work\Ec
lipse\workspace\DefendEmpire\frameworks\runtime-src\proj.android…/…/cocos2d-x
;E:\work\Eclipse\workspace\DefendEmpire\frameworks\runtime-src\proj.android…/.
./cocos2d-x/cocos/;E:\work\Eclipse\workspace\DefendEmpire\frameworks\runtime-src
\proj.android…/…/cocos2d-x/external;E:\work\Eclipse\workspace\DefendEmpire\fr
ameworks\runtime-src\proj.android…/…/cocos2d-x/cocos/scripting NDK_DEBUG=1’

make.exe: Entering directory E:/work/Eclipse/workspace/DefendEmpire/frameworks/
runtime-src/proj.android’
E:\work\Eclipse\workspace\DefendEmpire\frameworks\runtime-src\proj.android…/…
/cocos2d-x/cocos//scripting/lua-bindings/Android.mk:63: *** commands commence be
fore first target. Stop.
make.exe: Leaving directoryE:/work/Eclipse/workspace/DefendEmpire/frameworks/r
untime-src/proj.android’
Error running command, return code: 2

我用r9d 出现这个问题NDK build mode: debug
The Selected NDK toolchain version was 4.8 !
running: ‘/Users/MIt/Documents/androidDevTools/android-ndk-r9d/ndk-build -C /Users/MIt/Documents/cocos/HunterX/frameworks/runtime-src/proj.android -j3 NDK_MODULE_PATH=/Users/MIt/Documents/cocos/HunterX/frameworks/runtime-src/proj.android/…/…/cocos2d-x:/Users/MIt/Documents/cocos/HunterX/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/:/Users/MIt/Documents/cocos/HunterX/frameworks/runtime-src/proj.android/…/…/cocos2d-x/external:/Users/MIt/Documents/cocos/HunterX/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/scripting NDK_DEBUG=1’

Error running command, return code: 2

我跟楼主一样,换了NDK版本也没用,请教

**** Build of configuration Release for project CBFY_cpp ****

python E:/workspace/cocoa/cocos2d-x-3.2/cocos2d-x-3.2/tests/CBFY_cpp/proj.android/build_native.py -b release all
Android NDK: Invalid APP_STL value: c++_static
Android NDK: Please use one of the following instead: system stlport_static stlport_shared gnustl_static gnustl_shared gabi++_static gabi++_shared none
D:/android-ndk-r8e-windows-x86_64/android-ndk-r8e/build/core/add-application.mk:243: *** Android NDK: Aborting . Stop.
make: Entering directory E:/workspace/cocoa/cocos2d-x-3.2/cocos2d-x-3.2/tests/CBFY_cpp/proj.android' make: Leaving directory E:/workspace/cocoa/cocos2d-x-3.2/cocos2d-x-3.2/tests/CBFY_cpp/proj.android’
The Selected NDK toolchain version was 4.7 !
Traceback (most recent call last):
File “E:/workspace/cocoa/cocos2d-x-3.2/cocos2d-x-3.2/tests/CBFY_cpp/proj.android/build_native.py”, line 159, in
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
File “E:/workspace/cocoa/cocos2d-x-3.2/cocos2d-x-3.2/tests/CBFY_cpp/proj.android/build_native.py”, line 146, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
File “E:/workspace/cocoa/cocos2d-x-3.2/cocos2d-x-3.2/tests/CBFY_cpp/proj.android/build_native.py”, line 82, in do_build
raise Exception(“Build dynamic library for project " + app_android_root + " ] fails!”)
Exception: Build dynamic library for project E:\workspace\cocoa\cocos2d-x-3.2\cocos2d-x-3.2\tests\CBFY_cpp\proj.android ] fails!

顶,我也是这样提示的

我把 ndk-r8e-windows-x86_64 换成 r9d,编译通过了

:12:

我跟楼主报的错一样,我的ndk版本是android-ndk-r9-windows-x86_64,指定后还是依然不行

报的社么错误。

你的ndk路径是对的吗?

版主你好,我在3.2下用了r9d,结果报错如下,希望帮忙解答下:
make.exe: Entering directory J:/Game2/CocosLuaGame/frameworks/runtime-src/proj.android' make.exe: D:\android-ndk-r9d-windows-x86_64\android-ndk-r9d\build/core/build-local.mk: No such file or directory make.exe: Leaving directory J:/Game2/CocosLuaGame/frameworks/runtime-src/proj.android’
make.exe: *** No rule to make target `D:\android-ndk-r9d-windows-x86_64\android-ndk-r9d\build/core/build-local.mk’. Stop.
Running command: compile
Building mode: debug
building native
NDK build mode: debug
The Selected NDK toolchain version was 4.8 !
running: ‘D:\android-ndk-r9d-windows-x86_64\android-ndk-r9d\ndk-build -C J:\Game2\CocosLuaGame\frameworks\runtime-src\proj.android -j1 NDK_MODULE_PATH=J:\Game2\CocosLuaGame\frameworks\runtime-src\proj.android…/…/cocos2d-x;J:\Game2\CocosLuaGame\frameworks\runtime-src\proj.android…/…/cocos2d-x/cocos/;J:\Game2\CocosLuaGame\frameworks\runtime-src\proj.android…/…/cocos2d-x/external;J:\Game2\CocosLuaGame\frameworks\runtime-src\proj.android…/…/cocos2d-x/cocos/scripting NDK_DEBUG=1’

Error running command, return code: 2

可以在手机上面运行了吗?