Mali Graphics Debugger with unrooted Samsung Galaxy S7, Unreal Engine 4.12, and GearVR

Has anyone had any success getting the Arm Mali Graphics Debugger capturing GPU frames from an unrooted Galaxy S7 (or S6) running a UE4.12 game on the GearVR? I’m hesitant to root my S7 since it’s still under warranty, and will disable Samsung Pay, etc.

The instructions provided by the MGD documentation for unrooted android devices mention adding lines to your “” file (which I found in “Engine\Build\Android\Java\jni”), copying some files to your games “root” folder (assuming Content?) and adding code to the projects main activity class (my guess is “Engine\Build\Android\Java\src\com\epicgames\ue4\”).

I’ve done some googling and haven’t found any detailed instructions specifically for Unreal, and anything I’ve found are just questions from people who are having problems getting it working. Before I dive in, has anyone had any luck with this yet?

Hi mdespault,

I tried to run Mali Graphics Debugger (MGD) on our side and managed to get it working. You weren’t that far off!

First step, from the MGD package you downloaded you need to copy the whole “android-non-root” folder to your engine installation folder under “Engine/Build/Android/Java/”. You will need to work on a version of the engine from source, see Epic’s guide for that.

Next, you will need to edit the file under “Engine/Build/Android/Java/jni/” to add this line at the end, include $(LOCAL_PATH)/…/android-non-root/ It should look like this:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

include $(LOCAL_PATH)/../android-non-root/

After that you will need to edit your java main GameActivity located inside “Engine/Build/Android/Java/src/com/epicgames/ue4/” to add the MGD library loader. For that, just locate your onCreate function and add the following code just after the super call.

try {
catch( UnsatisfiedLinkError e ){
	Log.debug( "libMGD not loaded" );

Finally, install the MGD daemon on your phone using the following command while being in the android-non-root folder:
adb install -r MGDDaemon.apk

Now before running your app you will need to run this command from your PC (please ensure that you device in visible by running adb devices first):
adb forward tcp:5002 tcp:5002

Run the MGD daemon application on your phone and activate the daemon itself:

Once activated you can connect to it from MGD, using the connect icon at the top:

You can now start your application and start debugging it. Please refer to the MGD manual for more in-depth information on how to use it.

If you have any other issue while setting up MGD, or while using it do not hesitate to reply on this thread or contact us directly on our forums at

Awesome, thanks so much for the detailed reply Thomas! It sounds like the main thing I was missing was a version of the engine built from source, and otherwise everything seems pretty straightforward.