Source files in Android Studio

This currently driving me nuts. @atsushieno can you explain how I can get these to show up correctly? I’ve modified the paths to the my source in the CMakeLists.txt file so they are absolute, and app/build.gradle is pointed to the correct CMake file, but still no c++ sources are showing for me :frowning:

I have no definite ideas, but let me put some thoughts.
I guess your changes to make paths absolute would rather make it impossible for Android Gradle Plugin to locate the sources within its project file tree. Having them relative as Projucer does might make it show up.
This could happen if Projucer resolves the paths to JUCE modules from the global path.

Another possible cause is that your MODULEPATH for <ANDROIDSTUDIO> element in .jucer does not point to the path to (JUCE)/modules. Projucer still generates Builds/Android but the C++ sources would not show up.

Other causes why AS does not show the sources I can think of are…

  • projects in the JUCE source tree (projects AudioPluginHost) may resolve JUCE modules as libraries (target_link_libraries) which would give you only declarations (headers).
  • the project you loaded on Android Studio somehow has not performed native build stuff. “Build” → “Refresh Linked C++ Projects” might fix the issue. You only need to perform this one time.
  • depending on the Gradle/AGP (Android Gradle Plugin) versions it may only resolve the C++ files from app/src/main/cpp (e.g. when I mentioned it in this thread) There might be other conditions to make things loaded.

Thank you @atsushieno That was the issue. Once I disabled global paths, the source appeared just fine :slight_smile: