Can't access to Java aar archive from C++ (android project)

wab11
Tue, 09 Nov 2021 08:49:26 +0000
Mobile

Hey!

I’ve got a problem with accessing the class inside of the aar file
The aar archive is correctly attached to the project, but the class is still not visible.

JNIEnv * env = FAndroidApplication :: GetJavaEnv ();
// is always valid

jclass cPolarBleApi = env-> FindClass (“com / polar / sdk / api / PolarBleApi”);
// is always not valid

if (! cPolarBleApi)
GEngine-> AddOnScreenDebugMessage (-1, 15.0f, FColor :: Green, TEXT (“NULL Error”));

Link to the Aar library:
https://github.com/polarofficial/polar-ble-sdk/tree/master/polar-sdk-android/libs

However, if I create a clean project in android studio NDK and include this aar in the
app / build.gradle with:
dependencies
{
implementation files (‘libs / polar-ble-sdk.aar’)
}
It is in the android studio that with C ++ I have access to the code and the line:

jclass cPolarBleApi = env-> FindClass (“com / polar / sdk / api / PolarBleApi”);

compiles without any problem and the class is always found.
The same code in ue4 always returns nullptr - it means the class cannot be found.
The AndroidLib_UPL.xml file is properly set up.

1 post - 1 participant