I’m building a Unity Android app that makes use of some native android libraries. I had all of this nicely set up and working until I tried to move the calls to the native code onto another thread for performance reasons.
I first had the issue of the JNI not liking the threading, so adding in a AndroidJNI.AttachCurrentThread(); call fixed that fatal error. However now there is a new, non-fatal exception being thrown repeatedly and causing my native code to not work.
The stacktrace is below, but it seems to be centered around the lack of a com.unity3d.player.ReflectionHelper class not being found by the JVM.
Does anyone have any ideas where this could be going wrong?
Thanks
02-02 15:25:05.194 10248-10416/com.limoncello.androidtest E/mono: Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for UnityEngine.AndroidReflection ---> UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.ReflectionHelper" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib, /vendor/lib, /system/lib, /vendor/lib]]
java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.ReflectionHelper" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib, /vendor/lib, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at UnityEngine.AndroidJNISafe.CheckException () [0x0008c] in /Users/builduser/buildslave/unity/build/Runtime/Export/AndroidJNISafe.cs:24
at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x0000f] in /Users/builduser/buildsla