在cocos creator上编译安卓App的时候,在21 level下没问题,但19 level下回报如下错误:
- xxx/proj.android/../cocos2d/cocos/./platform/CCFileUtils.cpp:277:error:undefinedreferenceto'atof'
- xxx/proj.android/../cocos2d/cocos/./platform/CCFileUtils.cpp:286:error:undefinedreferenceto'atof'
- xxx/proj.android/../cocos2d/cocos/./base/CCConsole.cpp:1224:error:undefinedreferenceto'srand'
- xxx/proj.android/../cocos2d/cocos/./base/CCConsole.cpp:1225:error:undefinedreferenceto'rand'
- xxx/proj.android/../cocos2d/cocos/./base/CCConsole.cpp:1253:error:undefinedreferenceto'srand'
- xxx/proj.android/../cocos2d/cocos/./base/CCConsole.cpp:1254:error:undefinedreferenceto'rand'
- xxx/proj.android/../cocos2d/cocos/./base/ccUtils.cpp:254:error:undefinedreferenceto'atof'
- xxx/proj.android/../cocos2d/cocos/./base/ccRandom.h:117:error:undefinedreferenceto'rand'
- xxx/Pickle/proj.android/../cocos2d/cocos/./base/ccRandom.h:117:error:undefinedreferenceto'rand'
- xxx/proj.android/../cocos2d/cocos/./2d/CCActionTiledGrid.cpp:280:error:undefinedreferenceto'srand'
- xxx/proj.android/../cocos2d/cocos/./2d/CCActionTiledGrid.cpp:605:error:undefinedreferenceto'srand'
解决办法:
修改proj.android/jni/Application.mk文件,增加如下一行代码:
APP_PLATFORM := android-19
再重新编译就ok了,这样不管是编译x86的,还是arm得,还是armv7的就都不报错了。
原文链接:https://www.f2er.com/cocos2dx/338303.html