Announcement

Collapse
No announcement yet.

Android plugin that includes jni.h failing to build. How to build plugin for Android?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Android plugin that includes jni.h failing to build. How to build plugin for Android?

    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:
    Code:
    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:
    Code:
    #include <jni.h>
    #include <android/log.h>
    But when I try to build the plugin naturally I get the error:
    Code:
    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:
    1) Managed to build the project targeted to Android directly into Visual Studio, but it doesn't build the plugin.
    Last edited by AlfredBaudisch; 05-13-2014, 02:38 PM.

    #2
    Since it's been 15 days that I posted this without success yet, anyone has an idea?

    Comment


      #3
      Can you paste the contents of the *.cs files for your plugin? I'm not sure why all Android code wouldn't be able to include <jni.h>

      Also, what do you mean by "Managed to build the project targeted to Android directly into Visual Studio, but it doesn't build the plugin."?
      Josh Adams | Epic Games | Platform Team Lead

      Comment

      Working...
      X