Including shared object library in Android

Hi, I have a .so library that I wish to include in the project during runtime. I include it the same way as .a static library. However, at the beginning of the gameplay, it says library not found on the path C:/… (path on my c library). However, if I write the path for my Android device, it tells me it fails to compile becuase it doesn’t find the library during compiling time. Thanks

Hi FrankKappaPride,

I need some more information to help you here. I’m assuming you are trying to link to your .so during compile so it will load it at runtime on the device as a dependency?

If so, you want to use PublicAdditionalLibraries.Add() with a path to your .so if the TargetPlatform == UnrealTargetPlatform.Android in the Build.cs. You will also need to copy the .so for packaging by having an APL XML file. You can do something like this:

if (Target.Platform == UnrealTargetPlatform.Android)
	string BuildPath = Utils.MakePathRelativeTo(ModuleDirectory, BuildConfiguration.RelativeEnginePath);
	AdditionalPropertiesForReceipt.Add(new ReceiptProperty("AndroidPlugin", Path.Combine(BuildPath, "My_APL.xml")));

 	PublicAdditionalLibraries.Add(BuildPath + "/armv7/");

Then in your My_APL.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- steps to add to build additions -->
<root xmlns:android="">
	<!-- init section is always evaluated once per architecture -->
		<setBool result="bSupported" value="false"/>
		<isArch arch="armeabi-v7a">
			<setBool result="bSupported" value="true"/>

	<!-- optional files or directories to copy to Intermediate/Android/APK -->
		<isArch arch="armeabi-v7a">
			<copyFile src="$S(PluginDir)/armv7/"
						dst="$S(BuildDir)/libs/armeabi-v7a/" />

	<!-- optional libraries to load in before -->
		<if condition="bSupported">
				<loadLibrary name="myso" failmsg="Failed to load myso library" />

Put the XML file in the same directory as the Build.cs and your in an armv7 subdirectory.

Sorry for the late reply! But thanks to you I was able to get python(both compiler and other library) working in Gear VR! Just a minor detail, PublicAdditionalLibraries.Add(BuildPath + “/armv7/”);
this line seems to be pointing to a wrong directory. My engine is somewhere in Documents, my project is on desktop, however it tells me it doesnt find the so file at C:/Documents/Desktop/…/