Skip to content

Instantly share code, notes, and snippets.

@Ohmnivore
Last active February 5, 2018 22:19
Show Gist options
  • Save Ohmnivore/39b9a6e095f804859409ed51ca5c3c1d to your computer and use it in GitHub Desktop.
Save Ohmnivore/39b9a6e095f804859409ed51ca5c3c1d to your computer and use it in GitHub Desktop.
Arcane Android incantations to summon an ancient lime Daemon build

Up to date version: http://fouramgames.com/blog/arcane-android-incantations-legacy-openfl-android-build

My setup

The issue

I was able to compile with target-sdk 26, but I was getting the following error on launch: java.lang.UnsatisfiedLinkError: dlopen failed: library "/home/joshua/Development/Android/android-ndk-r8b/platforms/android-9/arch-arm/usr/lib/libc.so" not found.

You can find more info in this GitHub hxcpp issue and in this OpenFL forum post.

Cause

This happens because Android's dynamic linker underwent a breaking change in SDK 23. Old OpenFL/Lime versions were compiled with Android NDK version r8b which is incompatible with the new dynamic linker.

Solution

Make sure to use Android NDK r9d or later, and re-compile the Lime libraries with that newer NDK. Be careful with using r14 or later, as header files and some other files have been moved and/or renamed.

Java

  • Remove all installed java versions
  • Install Java JDK 1.8 64-bit jdk1.8.0_151 (64-bit), AND DO NOT INSTALL THE JRE
  • Set the JAVA_HOME environment variable to your JDK installation directory
  • The Android build process is often confused about which Java version to use and this creates conflicts. Be safe.

Android NDK

  • Download Android NDK version r9d 64-bit
  • Make sure Lime is pointed to its path

Android SDK

  • Download Android SDK Manager version 22.0.5
  • Make sure Lime is pointed to its path

Hack

  • Download Android SDK Tools version 26.0.1
  • Using Android SDK Tools run sdkmanager platforms;android-26
  • Copy <Android SDK Tools path>/platforms/android-26 over to <Android SDK Manager path>/platforms
  • Using Android SDK Tools run sdkmanager build-tools;26.0.3
  • Copy <Android SDK Tools path>/build-tools/26.0.3 over to <Android SDK Manager path>/build-tools
  • We do this because Android SDK Manager is incapable of downloading these packages, but can still use them if we just move them to the correct locations.

Re-compile Lime

  • Run openfl rebuild hxcpp android -clean
  • git clone Lime into <Haxe libs path>/lime
  • Checkout the tag containing your version of Lime (2.5.0 in my case)
  • Update the submodules
  • Rename your current Lime directory, and give its previous name to the cloned one
  • Run haxelib install format
  • Run lime rebuild android -Dlegacy
  • Run lime rebuild tools
  • The resulting Lime libraries will work with the new dynamic linker

Done!

  • Set <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="26"/> in your AndroidManifest.xml
  • Set <android target-sdk-version="26"/> in your Project.xml
  • Run lime build android -release and test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment