Swift on Android failing to link during runtime `System.load`

I love Swift. In fact, I love it so much that I'm building my own game engine, from scratch, just so I can use Swift for my day-to-day development work. Games on Apple platforms tend to have limited reach, so developing for Android is a great way to significantly increase my audience size. However, Swift is not supported for Android. Sort of. There are some amazing efforts by super smart folks that have allowed me to build my Swift games for Android, the first of which I released to both the App Store and Play Store last year! All of that is to say: I know Swift-first cross-platform development is possible because I've done it. But I am starting on an upgrade of my engine and a new game project, and upgraded my Android Studio version (to Electric Eel), my NDK version (to 25.1.XXX), and other details and I finally have everything building into a .so in a src/main/jniLibs folder in my Android project. Upon launch, however, when calling System.load("SimpleSwaps") crashes with an exception: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "UCNV_FROM_U_CALLBACK_STOP_71" referenced by "/data/app/~~YKZSrHhpcARXDne-qsQsCA==/com.bigbytestudios.SimpleSwaps-SpPUj44-DeMvkCjBboGuyA==/base.apk!/lib/arm64-v8a/libFoundation.so"..., suggesting that Android can't find some symbols. I was experiencing other similar linkage crashes when it was looking for libcurl.so as well. I expect that I'm the only person on this server/continent crazy enough to try these things, but I can't figure out how to fix these issues and hope that someone here can help me figure it out. Thanks!
1 Reply
grimlessbbs
grimlessbbs16mo ago
It turns out, for whatever reason, that the Unicode libraries were not being loaded automatically anymore (I have no idea why). So, to fix this, I have to manually load them using
System.loadLibrary("icuuc")
System.loadLibrary("icui18n")
System.loadLibrary("icuuc")
System.loadLibrary("icui18n")
BEFORE loading my main library System.load("SimpleSwaps")
Want results from more Discord servers?
Add your server