Getting Started: Android Development References - Documentation Feedback

I am referring to the Getting Started: Android Development guide.

I’d like to see more documentation around some key things.

  1. AndroidManifest.xml

In my case I need to be able to alter the AndroidManfest.xml to add an intent filter to show in the OUYA play section.

I’m able to build and run Unreal Engine 4.5.1 on the OUYA with File->Package Project->Android->Android (DXT).

I’d like to add a category to the activity’s intent-filter list like this.

Maybe there’s a way to add a configuration? Otherwise the alternative is to unpack the build with apktool to edit the manifest. That workaround is not ideal, it would be great to build it correctly the first time.

  1. APK size building a scene with a camera, light, and cube comes out to be 54MB. Any documentation on how to turn on build stripping to get the size down would be ideal.

  2. JNI - I’m looking for documentation on how to include the ouya-sdk.jar into the Unreal build. In addition to that an Android sample that uses JNI (finding Java classes in C++ and hooking the JNI_Onload routines) would be super helpful.

Here’s an example of what that looks like:

“JNI_OnLoad” is the entry point when a native library is loaded. You have a single opportunity to cache your Java classes so they can be invoked from C++.

From JNI_Onload that gives me access to add in-app-purchasing access for the OUYA. I use that to get product details, make purchases, check receipts, etc.

After installing TADP (referenced here Visual Studio has templates for the setup I’m looking for.

In Visual Studio 2013:
File->New Project->Templates->Android->Android Hello World Demo - A project for creating an Android application that uses Java and native code to print “Hello World”.

I’m looking for documentation around using Java and native code in the Unreal project.

  1. I’d like to see some documentation about including assets and resources.

My IAP sample app needs to include a signing key asset in the assets folder.

And then in the res/drawable folder I need to be able to place a custom icon 96x96.

And in res/drawable-xhdpi I need to be able to place a larger store icon 732x412.

Again apktool can decode the APK, add these files, and repackage. But looking for docs to customize these during the initial build process.

  1. If the Android manifest could be modified, the application could start with an alternative activity, load Java and native libraries, and then load the Unreal

Package=com.epicgames.VirtualController cmp=com.epicgames.VirtualController/com.epicgames.ue4.GameActivity

  1. Part of editing the AndroidManifest.xml more info on setting the package identifier would be useful. The package name seems to default to “com.epicgames.ProjectName”.


~Tim Graupmann

Most of the standard Android customizations can be done in the install folder, I.e.
C:\Program Files\Unreal\Epic Games\4.5\Engine\Build\Android\Java

** Just personal preference, but I really try to avoid making changes to “Program Files” folders when making plugins. Ideally these Java customizations that follow will be part of the Unreal Project in the future.*

Epic Games\4.5\Engine\Build\Android\Java\AndroidManifest.xml - Here the package name can be customized.

<manifest xmlns:android=“

And the intent filter can be added.

<category android:name=“tv.ouya.intent.category.GAME” />

The default icon can be set.


The custom icons can be placed in:
Epic Games\4.5\Engine\Build\Android\Java\res\drawable\app_icon.png
Epic Games\4.5\Engine\Build\Android\Java\res\drawable-xhdpi\ouya_icon.png

The signing key can be placed in:
Epic Games\4.5\Engine\Build\Android\Java\assets\key.der

The OUYA SDK can be placed in:
Epic Games\4.5\Engine\Build\Android\Java\libs\ouya-sdk.jar

The native plugin can be placed in:
Epic Games\4.5\Engine\Build\Android\Java\libs\armeabi\
Epic Games\4.5\Engine\Build\Android\Java\libs\x86\armeabi-v7a
Epic Games\4.5\Engine\Build\Android\Java\libs\x86\

Edit Epic Games\4.5\Engine\Build\Android\Java\libs\ to add the native library:

include $(CLEAR_VARS)
LOCAL_MODULE := -ouya-ndk

Loading the native library can be called from:
Epic Games\4.5\Engine\Build\Android\Java\src\com\epicgames\ue4\

  • static {

Placing files into the following folders includes as expected:
Epic Games\4.5\Engine\Build\Android\Java\assets
Epic Games\4.5\Engine\Build\Android\Java\res\drawable
Epic Games\4.5\Engine\Build\Android\Java\res\drawable-xhdpi\

Placing the ouya-sdk.jar gets dexified
Epic Games\4.5\Engine\Build\Android\Java\libs\ouya-sdk.jar

Placing the Native library put one in the jni folder so the build process completes:
Epic Games\4.5\Engine\Build\Android\Java\jni\

And then put one in the standard Android place:
Epic Games\4.5\Engine\Build\Android\Java\libs\armeabi\

And then you’ll see the JNI_OnLoad fire as expected:

D/dalvikvm(24309): Trying to load lib /data/data/com.epicgames.VirtualController/lib/ 0x41f27320
D/dalvikvm(24309): Added shared lib /data/data/com.epicgames.VirtualController/lib/ 0x41f27320
I/jni.cpp (24309): JNI_OnLoad

I’ve needed to run the TADP 2.X version that comes with Unreal. Unfortunately this version is limited as it doesn’t setup my Visual Studio properly with the templates needed for Android development. Of course it’s the only way to get File->Package in Unreal to work with this 2.X version.

Versus the 3.X version which properly sets up my VS 2012 and VS 2013 templates for proper Java and Native development. Is there a timeline when Unreal will support 3.X?

I’ve made an isolated project for a NativeActivity where I detect native input, route that input to Java, remap the input with the OUYA-sdk.jar, and then pass the remapped input back to native code.

Now I need to know where the UE4 Input processing happens.

The NDK samples usually show something like:


  • Process the next input event.
    static int32_t engine_handle_input(struct android_app
    app, AInputEvent* event) {


void android_main(struct android_app* state) {

struct engine engine;

// Make sure glue isn't stripped.

memset(&engine, 0, sizeof(engine));
state-&gt;userData = &engine;
state-&gt;onAppCmd = engine_handle_cmd;
state-&gt;onInputEvent = engine_handle_input;

Even the NativeActivity documentation uses “engine_handle_input”:

Now I’m wondering where this routine happens in UE4. Will I need to search the github source and will it be something I can override or will I need to modify the engine?


Since logcat is showing:

D/UE4 ( 2567): Received keycode: 96
D/UE4 ( 2567): Received gamepad button: 96

Most likely the input is being handled in:

So I’ll dive into that native code…

Here’s an area for documentation. - This is where the awesome Native Android logic happens -

And… here is where the input handling is coming in.

Input is coming in through a method called “HandleInputCB” part of LaunchAndroid.cpp.

I’m looking for some tips when I edit:

I’ve found I need to rebuild the Solution->Engine->UE4 in Visual Studio to regenerate the code that builds

Is there a faster way to make changes and a specific project I can rebuild versus rebuilding the entire editor?

Also another note:

#include “LaunchPrivatePCH.h”

LaunchPrivatePCH.h needs to be the first include in any cpp files that you add to the

This is a faster way to at least find your native C++ compiler mistakes faster:

cd C:\unreal\UnrealEngine\Engine\Binaries\DotNET
UnrealBuildTool.exe VirtualController Android Development C:\ouya-sdk-examples\Unreal\VirtualController\VirtualController.uproject -noxge

I’ve also seen the Unreal build output doesn’t give you a nice stack trace for Java compile errors. But you can import the immediate files into an Eclipse Android project:

And copy from: C:\ouya-sdk-examples\Unreal\VirtualController\Intermediate\Android\APK\google-play-services_lib_rev19\libs\google-play-services.jar

to: C:\ouya-sdk-examples\Unreal\VirtualController\Intermediate\Android\APK\libs

To isolate any Java errors that might be coming up.

Success in my end though.

Now I have native input passed to Java, remapped, and the remapped input is sent back to Unreal native code.

Now it’s time to learn how to hook up BluePrints to C++ code…

I made a video for my next question.

I’m trying to get a class blueprint to call my C++ code.

I posted the question in the UE4 answer hub.

I’m following the documentation section on Delegates.

Solved: I needed to use BlueprintCallable on the UFUNCTION.

My next question is how do I call Android specific code from C++ Actor code.

Edit: works!

Just make sure the BluePrint is calling the event…

At this point I can pass remapped input to BluePrints and use in the Tappy Chicken project.

The input mapping is working well at this point.

The next step will be adding OUYA In-App-Purchases.

Now I’m just looking to find out how to share the fork.

The OUYA Fork of UE4 is now accessible and here’s the new OUYA documentation.