I’m trying to fix a bug that’s been reported with one of our plugins, but seem to be having trouble with the build system within Android Studio and I’ve a hunch this is somehow related to the 64bit support that’s been recently added?
In a nutshell, whatever I do, after Gradle finishes the build and tries to launch my sample app on a connected Android device, the app just flashes open and then closed again, Android Studio times out waiting to see it, and the following error is piped out:
2019-12-10 19:04:09.789 26686-26686/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycompany.app, PID: 26686
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.mycompany.app-9s8f8cF8Z13BdIubYCMdXQ==/base.apk”],nativeLibraryDirectories=[/data/app/com.mycompany.app-9s8f8cF8Z13BdIubYCMdXQ==/lib/arm64, /system/lib64]]] couldn’t find "liblua.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
at java.lang.System.loadLibrary(System.java:1669)
at com.ansca.corona.JavaToNativeShim.<clinit>(JavaToNativeShim.java:141)
at com.ansca.corona.JavaToNativeShim.useJavaLuaErrorHandler(JavaToNativeShim.java:299)
at com.ansca.corona.CoronaEnvironment.setLuaErrorHandler(CoronaEnvironment.java:416)
at com.ansca.corona.CoronaEnvironment.<clinit>(CoronaEnvironment.java:75)
at com.ansca.corona.CoronaEnvironment.addRuntimeListener(CoronaEnvironment.java:459)
at com.mycompany.app.CoronaApplication.onCreate(CoronaApplication.java:23)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1165)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6184)
at android.app.ActivityThread.access$1300(ActivityThread.java:208)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1785)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:7009)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
The key seems to be the part I’ve highlighted in bold. It’s looking in arm64 / lib64 for liblua.so and failing to find anything?
Googling, I found this: https://medium.com/mobiwise-blog/unsatisfiedlinkerror-problem-on-some-android-devices-b77f2f83837d
He’s talking about abiFilters and useDeprecatedNdk configurations which to be honest just don’t mean anything to me. I’m cautious about hacking away at Gradle files without understanding what I’m doing, and I’m conscious that this article isn’t Corona specific.
Everything I’m finding on Google suggests that this issue started with Android Studio 3.5. I’m currently running 3.5.3 so it’s possible that I was in a 3.4 build the last time this worked. It’s been a while since I did anything to this plugin now.
It’s also possible that this is the first time I’ve tried building since Corona was given 64bit support, though I’m not sure how relative that is with native builds.
Help please =).