AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt6chrono3_V212steady_clock3nowEv" referenced by "/data/app/com.Company.Game/lib/arm/libUE4.so"

Hi all,

I have been attempting to deploy a game to my Android device and have been hitting many issues. This, hopefully
last, issue has got me stumped.

The game is being built with a custom plugin that is essentially just the AWS Core found here: aws-sdk-cpp/aws-cpp-sdk-core at master · aws/aws-sdk-cpp · GitHub
I have compiled the AWS Core so files by running

cmake -G "NMake Makefiles" -DTARGET_ARCH=ANDROID -DBUILD_ONLY="core;apigateway" DANDROID_TOOLCHAIN_NAME="standalone-clang" -DNDK_DIR="D:\NVPACK\android-ndk-r14b" -DCMAKE_BUILD_TYPE=Release .

cmake --build . --target CURL
cmake --build .
cmake --build . --target install

in the Developer Command Prompt for VS.

The AWSCore_armv7.xml in my project looks like this:

<?xml version="1.0" encoding="utf-8"?>

<root xmlns:android="http://schemas.android.com/apk/res/android">
	
	<init>
		<log text="AWSCore_armv7 init"/>	
	    <setBool result="bSupported" value="false"/>
	        <isArch arch="armeabi-v7a">
	            <setBool result="bSupported" value="true"/>
	        </isArch>
	</init>

	<resourceCopies>
	    <isArch arch="armeabi-v7a">

	    	<log text="Now copying libaws-cpp-sdk-core.so"/>
	        <copyFile src="$S(PluginDir)/libaws-cpp-sdk-core.so"
	                  dst="$S(BuildDir)/libs/armeabi-v7a/libaws-cpp-sdk-core.so" />

	        <log text="Now copying libaws-c-common.so"/>
	        <copyFile src="$S(PluginDir)/libaws-c-common.so"
	                  dst="$S(BuildDir)/libs/armeabi-v7a/libaws-c-common.so" />

	        <log text="Now copying libaws-c-event-stream.so"/>
	        <copyFile src="$S(PluginDir)/libaws-c-event-stream.so"
	                  dst="$S(BuildDir)/libs/armeabi-v7a/libaws-c-event-stream.so" />

	        <log text="Now copying libaws-checksums.so"/>
	        <copyFile src="$S(PluginDir)/libaws-checksums.so"
	                  dst="$S(BuildDir)/libs/armeabi-v7a/libaws-checksums.so" />

		</isArch>
	</resourceCopies>

	<soLoadLibrary>
	    <if condition="bSupported">
	        <true>
		    <loadLibrary name="aws-cpp-sdk-core" failmsg="Failed to load libaws-cpp-sdk-core library" />
		    <loadLibrary name="aws-c-common" failmsg="Failed to load libaws-c-common library" />
		    <loadLibrary name="aws-c-event-stream" failmsg="Failed to load libaws-c-event-stream library" />
		    <loadLibrary name="aws-checksums" failmsg="Failed to load libaws-checksums library" />
			</true>
	    </if>
	</soLoadLibrary>

  <androidManifestUpdates>
    <addPermission android:name="android.permission.WRITE_EXTERNAL_STORAGE"  />
  </androidManifestUpdates>
</root>

A previous prominent error I got in the logcat was: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found

I had to edit the Engine’s UEDeployAndroid.cs to resolve it. The edit is point number 5 in this post: [UE4][Android NDK]error 'to_string' is not a member of 'std'
Commenting out gnu-libstdc++ portion on CopySTL. I’m mentioning this because the major error’s function signature is of chrono::steady_clock::now which I believe is part of the std. So might be the culprit?

After the libc++_shared.so error I then started to get this error:

AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt6chrono3_V212steady_clock3nowEv" referenced by "/data/app/com.Company.Game/lib/arm/libUE4.so"

in the logcat and haven’t been able to shake it. When starting the app on my device, it immediately exits and says “Unfortunately, Game has Stopped.”. There are some other posts with similar issues but their solutions haven’t revolved it.
Also, it is worth noting that if I disable or delete the custom plugin I still get this error. However, I do remember deploying successfully without the plugin before, which seems to suggest a recent change is causing the issue.
[Update: If the plugin is deleted and I undo the libc++_shared.so fix, it deploys successfully.]

I am using:

  • UE4.21.2 to package Android_ETC2
  • Enable Gradle instead of Ant: Checked
  • Install Location: Auto
  • Minimum SDK Version: 19 (also tried
    default of 9)
  • Target SDK Version: 19 (also tried
    default of 9)
  • Support armv7 [aka armeabi-v7a]
  • Android NDK r14b
  • NDK API Level: android-19 (also tried
    latest and 26, same issue. tried 23
    but got an error in the build
    process)
  • SDK API Level: matchndk (also tried
    lastest)

My Android Device:

  • Samsung Galaxy Note 4
  • Android version: 6.0.1

Any help would be appreciated.
Thanks!