Shibin Raju Mathew
Shibin Raju Mathew

Reputation: 930

Can't compile android cocos2d file --Android-Studio

Getting some error even for sample cocos2d helloworld file.

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);

how to solve?

Upvotes: 2

Views: 1416

Answers (1)

AAryan
AAryan

Reputation: 20140

Android NDK: android-13 is unsupported. Using minimum supported version android-14.

Add APP_PLATFORM := android-14 in Application.mk file

If you do not have that line then version of your SDK is taken from project.properties files.


#include <unistd.h> header is missing in ProcessCpuTracker.cpp file for NDK v15

check this answer for more detail.

Upvotes: 4

Related Questions