Error loading JNI.h and jni_md.h

I am working on a plugin that uses a 3rd party JAR to add functionality to android builds. I am using the AndroidJNI.h as a wrapper for my java class that interacts with the JAR file. Whenever I try to build my game the build fails at first because it couldn’t find the JNI.h file that the AndroidJNI.h file needed. To fix this I added the path to it in the include directories for the game. Now it can’t find the jni_md.h file which is one sub folder down from the JNI.h file. I added in the directory to this file as well but that didn’t help. Has anyone else ran across this problem or have an idea on what I can do to fix it so that I can build my plugin? Any help would be greatly appreciated.

On what build configuration does your build fail?

It fails in the development build and I haven’t tried any others. I am trying to make my plugin accessible in blueprints as well.

So, your bult target platform is Win64?

Yes. Changing it to 32 it can’t find the JNI.h but under the 64 it can’t find jni_mh.h that is in the JNI.h file.

By “build the game” you mean when you build modules for editor build of engine or when you package the game that use your plugin?

When I try to launch the game via the Editor it can’t build the plugin. So I open the C++ code and build solution and it fails there. I haven’t tried to package because I can’t get into the editor without disabling the plugin or removing the crucial part of my plugin.

Does your code and JNI stuff suppose to work on Windows?

Not exactly. The JNI part is for Android builds and will only be included in such, but the plugin needs to be blueprintable hence the windows part. It doesn’t seem like it is any of the code I wrote that is causing the error. For whatever reason the AndoridJNI class that is part of the engine can’t find the necessary JNI files to get compiled. I used the Android setup provided by Unreal to install the JDK, Android SDK and change the environment variables so all of that should be correct.

Currently, UE only adds JNI directories to header search directory when building for Android. Any code that touches JNI cannot be build for non-Android target.

You should either move all of this code to separate files, that aren’t compiled in development editor builds or #ifdef all relevant includes and code under PLATFORM_ANDROID