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:
I managed to generate the library and locate the .a
files for each configuration (arm64-v8a
, armeabi-v7a
, x86
, x86_64
).
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 mylibJuceDemo.a
in each directory -
I also added a
include
directory withJuceHeader.h
,JuceTest.h
andAppConfig.h
in it, as you can see here:
-
I added the following in my
CMakeLists.txt
file:
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 theJuceTest.h
header like this:
#include "jucedemo/lib/include/JuceTest.h
- In that same file (
native-lib.cpp
), in a function, I try to use theJuceTest
class:
jucetest::JuceTest juceTest;
juceTest.getTexte();
Now when I try to compile and run my Android app, I get these errors:
error: undefined reference to 'jucetest::JuceTest::JuceTest()'
error: undefined reference to 'jucetest::JuceTest::getTexte()'
error: undefined reference to 'jucetest::JuceTest::~JuceTest()'
I believe there is something wrong with the content of the JuceTest.h
header file in the include
directory, but I can’t find what it is.
Thanks for your help.