I've faced an issue that AndroidStudio has a problem with indexing files that are in the NDK package. So, for example, if we take the standard AndroidStudio example of the NativeActivity (code is also available on GitHub) and activate files indexing (for example by clicking Build->Refresh C++ Projects
) we obtain endless Scanning files to index...
It seems that AndroidStudio does not like the paths where native_app_glue
stuff is located, from CMakeLists.txt from mentioned example:
add_library(native_app_glue STATIC
${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
...
target_include_directories(native-activity PRIVATE
${ANDROID_NDK}/sources/android/native_app_glue)
In my case ${ANDROID_NDK}
is /home/nikolay/Projects/Android/AS/Sdk/ndk/21.3.6528147
Nothing helps, no AndroidStudio restart (after restarting AndroidStudio is stuck on Loading project...
), no File->Invalidate Caches/Restart
, no deleting .gradle, .idea, app/.cxx, app/build
folders, no applying Inotify Watches Limit.
But only copying native_app_glue
sources to place without 21.3.6528147
in path, adapting CMake accordingly:
add_library(native_app_glue STATIC
native_app_glue/android_native_app_glue.c)
...
target_include_directories(native-activity PRIVATE
native_app_glue)
deleting .gradle, .idea, app/.cxx, app/build
folders and restart AndroidStudio.
Has anyone faced such an issue or maybe the problem is only in my place? Thanks a lot for any help.
P.S.: Used AndroidStudio is 4.1
Was figured out that it is a known issue in Android Studio 4.1 (thanks @protossor for confirming) and currently under fixing: https://issuetracker.google.com/issues/171801044
So, it only remains to wait for a new Android Studio release to check whether the problem is fixed or not (results will be shared).