ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
61.07k stars 10.29k forks source link

Android backend build error: ALooper_pollAll has been deprecated on Android NDK Version 27 #8013

Closed feather179 closed 1 week ago

feather179 commented 1 month ago

Version/Branch of Dear ImGui:

Version 1.90, Branch: master

Back-ends:

imgui_impl_android.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Android Studio with NDK version 27.1.12297006

Full config/build information:

No response

Details:

D:\Android\Sdk\ndk\27.1.12297006\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android24 --sysroot=D:/Android/Sdk/ndk/27.1.12297006/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DIMGUI_IMPL_OPENGL_ES3 -DImGuiExample_EXPORTS -ID:/imgui-1.90/examples/example_android_opengl3/../.. -ID:/imgui-1.90/examples/example_android_opengl3/../../backends -ID:/Android/Sdk/ndk/27.1.12297006/sources/android/native_app_glue -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -std=c++11 -fPIC -MD -MT CMakeFiles/ImGuiExample.dir/main.cpp.o -MF CMakeFiles\ImGuiExample.dir\main.cpp.o.d -o CMakeFiles/ImGuiExample.dir/main.cpp.o -c D:/imgui-1.90/examples/example_android_opengl3/main.cpp

D:/imgui-1.90/examples/example_android_opengl3/main.cpp:98:16: 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
   98 |         while (ALooper_pollAll(g_Initialized ? 0 : -1, nullptr, &out_events, (void**)&out_data) >= 0)
      |                ^
D:/Android/Sdk/ndk/27.1.12297006/toolchains/llvm/prebuilt/windows-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)
      |     ^

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();
feather179 commented 1 month ago

Just change the called API from ALooper_pollAll to ALooper_pollOnce,and it works well.

ocornut commented 1 week ago

I have pushed the suggested change as f77d228. Thank you!