Search code examples
androidunity-game-enginejava-native-interface

Native C++ and Java Android Library in Unity


I have a native android library that I am trying to use from the Unity Edtor. The library is compiled into and aar file, and has both C++ and Java code. I have placed the AAR file inside the plugins folder and it works fine on the device, but does not work on the editor.

On the editor, I can successfully instantiate an AndroidJavaObject, but when I try to call one of its functions that return a string, I get a null. This works fine on the target device, but I need it work on the editor for debugging purposes.

Do I have to set the JNI path by any chance for it to work? Do I have to have it in a different format like a .so?

Thanks in advance


Solution

  • Unfortunately it is not possible, Unity Editor does not provide this feature, use either a real device or emulator.