0

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

Mykola Khyliuk
  • 1,234
  • 1
  • 9
  • 16
  • 1
    Hi, this is a known issue in Android Studio 4.1 and the team is working on a fix. See https://b.corp.google.com/issues/171801044. In the mean time, you can copy the native_app_glue.c inside your project to workaround it for now. – tgeng Oct 30 '20 at 04:17
  • Hi @protossor, thank you for confirming that issue does really exist. About copying ```native_app_glue.c```, yes as I mentioned in the description, only this helped. Regarding the link provided, unfortunately this is probably a restricted resource and I have no permission to enter it. – Mykola Khyliuk Oct 30 '20 at 08:35
  • 1
    Ah my bad! You can see the issue with https://issuetracker.google.com/issues/171801044. – tgeng Oct 30 '20 at 17:54
  • Thanks, added this link to the answer. – Mykola Khyliuk Oct 30 '20 at 18:15

1 Answers1

0

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

Mykola Khyliuk
  • 1,234
  • 1
  • 9
  • 16