I’m working on testing out an Android InputDevice plugin. At the moment I’ve modified FAndroidApplication to load modular input devices the same as FWindowsApplication does.
The problem I’ve got is using the JNI in the plugin itself. In CreateInputDevice() I’m calling the following
extern JNIEnv* GetJavaEnv(bool bRequireGlobalThis = true);
JNIEnv* env = GetJavaEnv();
const jclass cls = env->FindClass("com/bda/controller/Controller");
mMethodInit = env->GetMethodID(cls, "init", "()Z");
on the GetMethodID call I’m crashing out with the following:
D/UE4 ( 998): D:\UE4Public\UnrealEngine-4.0\Engine\Source\Runtime\Core\Private\Misc\OutputDevice.cpp(176): Fatal error:
D/UE4 ( 998): Assertion failed: IsInRenderingThread() [File:D:\UE4Public\UnrealEngine-4.0\Engine\Source\Runtime\RenderCore\Private\RenderResource.cpp] [Line: 39]
D/UE4 ( 998): [2014.03.23-10.49.44:738][ 0]LogOutputDevice:Fatal: Assertion failed: IsInRenderingThread() [File:D:\UE4Public\UnrealEngine-4.0\Engine\Source\Runtime\RenderCore\Private\RenderResource.cpp] [Line: 39]
Any ideas on this? I figured that it might be because the current thread is the RenderThread so the JVM is getting attached to that, rather than the game thread, but I can’t figure out how to fix that. Any suggestions? This code doesn’t crash if I do it in JNI_OnLoad, but putting it there for a plugin isn’t ideal.