Hello,
I wrote a test Android plugin, using GameActivity.java and the logic contained in Runtime/Launch/Private/Android/AndroidJNI.cpp in order to communicate from Java to C++.
In my plugin I have this example code just to test the calls:
extern "C" void Java_com_epicgames_ue4_GameActivity_nativeMyPluginStarted(JNIEnv* jenv, jobject thiz, jboolean isStarted)
{
if(isStarted)
FPlatformMisc::LowLevelOutputDebugString(L"===> CUSTOM --- STARTED");
else
FPlatformMisc::LowLevelOutputDebugString(L"===> CUSTOM --- NOT STARTED");
}
In this cpp file I’m including the native Android headers:
#include <jni.h>
#include <android/log.h>
But when I try to build the plugin naturally I get the error:
Error 1 error C1083: Cannot open include file: 'jni.h': No such file or directory
How can I do that kind of external communication in my plugin? (Call a C++ function from the Java activity, just like the engine’s code does, but in the plugin code? If I manage to include jni.h it will work.
Any help would be appreciated, thanks.
EDITED:
- Managed to build the project targeted to Android directly into Visual Studio, but it doesn’t build the plugin.