I’m getting the following error while building my project.
Can somebody help me?
The error is: ‘ALooper_pollAll’ is unavailable: obsoleted in Android 1 - ALooper_pollAll may ignore wakes. Use ALooper_pollOnce instead. See The API documentation for more information [arm64-v8a]
/Applications/Cocos/Creator/3.8.6/CocosCreator.app/Contents/Resources/resources/3d/engine/native/external/sources/Swappy/src/swappy/common/ChoreographerThread.cpp:220:9: error: 'ALooper_pollAll' is unavailable: obsoleted in Android 1 - ALooper_pollAll may ignore wakes. Use ALooper_pollOnce instead. See The API documentation for more information
220 | ALooper_pollAll(-1, &outFd, &outEvents, &outData);
| ^
/Users/samova/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/android/looper.h:228:5: note: 'ALooper_pollAll' has been explicitly marked unavailable here
228 | int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData)
| ^
It seems that it can be solved by following the sugguestion from Gemini. Original Code (around line 220):
c++
while (mThreadRunning) {
// mutex should be unlocked before sleeping on pollAll
mWaitingMutex.unlock();
ALooper_pollAll(-1, &outFd, &outEvents, &outData); // <--- This line causes the error
mWaitingMutex.lock();
}
Modified Code:
c++
while (mThreadRunning) {
// mutex should be unlocked before sleeping on pollOnce
mWaitingMutex.unlock();
int result = ALooper_pollOnce(-1, &outFd, &outEvents, &outData);
// You MUST treat all return values as if they also indicate ALOOPER_POLL_WAKE.
// This means you should process events regardless of the specific 'result' value,
// as long as mThreadRunning is true.
// Specific handling for ALOOPER_POLL_TIMEOUT, ALOOPER_POLL_CALLBACK,
// ALOOPER_POLL_ERROR can be added here if needed, but for the
// general case of waking up to check mThreadRunning, no special
// result check is strictly necessary.
mWaitingMutex.lock();
}