无法编译androidcocos2d文件--Android-Studio
Can't compile android cocos2d file --Android-Studio
即使是示例 cocos2d helloworld 文件也会出现一些错误。
Android NDK: android-13 is unsupported. Using minimum supported version android-14.
[armeabi] Compile++ thumb: cocos2dxandroid_static <= ProcessCpuTracker.cpp
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp: In function 'std::vector<_CpuInfo> readProcStat()':
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp:69:54: error: 'read' was not declared in this scope
const int len = read(fd, buffer, sizeof(buffer)-1);
^
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp:70:13: error: 'close' was not declared in this scope
close(fd);
如何解决?
Android NDK: android-13 is unsupported. Using minimum supported
version android-14.
在 Application.mk
文件中添加 APP_PLATFORM := android-14
如果您没有该行,那么您的 SDK 版本将从 project.properties
个文件中获取。
#include <unistd.h>
header 在 NDK v15
的 ProcessCpuTracker.cpp
文件中缺失
查看 this 答案了解更多详情。
即使是示例 cocos2d helloworld 文件也会出现一些错误。
Android NDK: android-13 is unsupported. Using minimum supported version android-14.
[armeabi] Compile++ thumb: cocos2dxandroid_static <= ProcessCpuTracker.cpp
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp: In function 'std::vector<_CpuInfo> readProcStat()':
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp:69:54: error: 'read' was not declared in this scope
const int len = read(fd, buffer, sizeof(buffer)-1);
^
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp:70:13: error: 'close' was not declared in this scope
close(fd);
如何解决?
Android NDK: android-13 is unsupported. Using minimum supported version android-14.
在 Application.mk
文件中添加 APP_PLATFORM := android-14
如果您没有该行,那么您的 SDK 版本将从 project.properties
个文件中获取。
#include <unistd.h>
header 在 NDK v15
ProcessCpuTracker.cpp
文件中缺失
查看 this 答案了解更多详情。