JUCE static library for Android: juce_audio_basics.h not found

Thanks to the Projucer, I created this very basic project, just to understand how to generate a static library for Android and how to import it on an Android project.

The library project can be found here .

I managed to generate the library and locate the .a files for each configuration (arm64-v8a , armeabi-v7a , x86 , x86_64), in build/intermediates/cmake/release_Release/obj/.

Now I’m trying to import it on an Android project, and here is what I did:

  • in src/main/cpp/jucedemo/lib , I added the 4 directories ( arm64-v8a , armeabi-v7a , x86 , x86_64 ), with the different versions of my libJuceDemo.a in each directory

  • I also added a include directory with the header files in it, as you can see here:

  • Then, in my CMakeLists.txt:

set(JuceDemo_DIR ${CMAKE_SOURCE_DIR}/src/main/cpp/jucedemo)
add_library(JuceDemo STATIC IMPORTED)
set_property(TARGET JuceDemo PROPERTY
             IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/src/main/cpp/jucedemo/${ANDROID_ABI}/libJuceDemo.a)
set_target_properties(JuceDemo PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                      ${CMAKE_SOURCE_DIR}/src/main/cpp/jucedemo/lib/include)
include_directories(${JuceDemo_DIR}/lib/include)

target_link_libraries(
        native-lib
        ${JuceDemo_DIR}/lib/${ANDROID_ABI}/libJuceDemo.a)

Then I tried to call the code of the library from my JNI (C++) code of my Android app:

  • In another C++ file of my Android project ( native-lib.cpp ), I import the JuceTest.h header like this:
#include "jucedemo/lib/include/JuceTest.h
  • In that same file ( native-lib.cpp ), in a function, I try to use the JuceTest class:
jucetest::JuceTest juceTest;
juceTest.getTexte();

Now when I try to compile and run my Android app, I get these errors:

:../../../../src/main/cpp/jucedemo/lib/include/JuceHeader.h:17:10: fatal error:
'juce_audio_basics/juce_audio_basics.h' file not found

Actually, none of the #include<juce_...> in the JuceHeader.h file are working…

How can I fix that?

Thanks.