由于项目的需要,我使用Cocos2dx 3.16创建新项目,iOS可以正常编译运行起来了。
但是 Android折腾了很久都无法编译运行,悲剧。
我的环境: MacOS 10.15.7
Andorid Studio: 4.1.2
NDK: 专门下载了r14b
实现步骤:
1、cd {Cocos2dx3.16目录}
2、cocos 创建新cpp项目
3、打开AS ,导入 proj.android-studio
4、构建、编译。
然后各种报错:
1、ndk.dir 指定
2、升级gradle版本
3、追加google()
4、SDK Build ToolsVersion 更改
……
最后,贴一部分错误信息,供参考,请大侠指点!
Task :libcocos2dx:mergeDebugShaders
Task :libcocos2dx:mergeDebugShaders in libcocos2dx Starting
Caching disabled for task ‘:libcocos2dx:mergeDebugShaders’ because:
Build cache is disabled
Task ‘:libcocos2dx:mergeDebugShaders’ is not up-to-date because:
Output property ‘incrementalFolder’ file /Users/mayici/Cocos2dx-Prjs/Test316/cocos2d/cocos/platform/android/libcocos2dx/build/intermediates/incremental/mergeDebugShaders has been removed.
Output property ‘incrementalFolder’ file /Users/mayici/Cocos2dx-Prjs/Test316/cocos2d/cocos/platform/android/libcocos2dx/build/intermediates/incremental/mergeDebugShaders/merger.xml has been removed.
Output property ‘outputDir’ file /Users/mayici/Cocos2dx-Prjs/Test316/cocos2d/cocos/platform/android/libcocos2dx/build/intermediates/merged_shaders/debug/out has been removed.
The input changes require a full rebuild for incremental task ‘:libcocos2dx:mergeDebugShaders’.
Unable do incremental execution: full task run
Task :libcocos2dx:mergeDebugShaders in libcocos2dx Finished
:libcocos2dx:mergeDebugShaders (Thread[Execution worker for ‘:’ Thread 2,5,main]) completed. Took 0.004 secs.
:libcocos2dx:compileDebugShaders (Thread[Execution worker for ‘:’ Thread 2,5,main]) started.