java.lang.UnsatisfiedLinkError: No implementation found for void org.libsdl.app.SDLActivity.nativeSetenv

Viewed 1044

I'm trying to run an APK that I generated using buildozer. After trying to run on several devices both physical and virtual, I always get the same error:

2022-02-08 18:05:17.702 10070-10070/org.test.butterfly E/AndroidRuntime: FATAL EXCEPTION: main
        Process: org.test.butterfly, PID: 10070
        java.lang.UnsatisfiedLinkError: No implementation found for void org.libsdl.app.SDLActivity.nativeSetenv(java.lang.String, java.lang.String) (tried Java_org_libsdl_app_SDLActivity_nativeSetenv and Java_org_libsdl_app_SDLActivity_nativeSetenv__Ljava_lang_String_2Ljava_lang_String_2)
            at org.libsdl.app.SDLActivity.nativeSetenv(Native Method)
            at org.kivy.android.PythonActivity$UnpackFilesTask.onPostExecute(PythonActivity.java:157)
            at org.kivy.android.PythonActivity$UnpackFilesTask.onPostExecute(PythonActivity.java:102)
            at android.os.AsyncTask.finish(AsyncTask.java:771)
            at android.os.AsyncTask.access$900(AsyncTask.java:199)
            at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:223)
            at android.app.ActivityThread.main(ActivityThread.java:7656)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

This is my first time using Android Studio, and until now I didn't find a proper solution for this error. I would appreciate any help.

You can download the APK in the link below:

https://drive.google.com/file/d/1B8D2fbUg5-3nlkJHFDJHrwAciKPtftkF/view?usp=sharing
1 Answers

The error message No implementation found for void org.libsdl.app.SDLActivity.nativeSetenv(java.lang.String, java.lang.String) (tried Java_org_libsdl_app_SDLActivity_nativeSetenv and Java_org_libsdl_app_SDLActivity_nativeSetenv__Ljava_lang_String_2Ljava_lang_String_2) means that non of the loaded .so libraries of your app provides a matching method that implements the native method org.libsdl.app.SDLActivity.nativeSetenv.

So one library of your app has to export a method named Java_org_libsdl_app_SDLActivity_nativeSetenv respectively Java_org_libsdl_app_SDLActivity_nativeSetenv__Ljava_lang_String_2Ljava_lang_String_2 and this library has to be loaded using System.loadLibrary before you can call a native method.

Comparing the libs sub-folders it is obvious that something is wrong with the APK:

lib\arm64-v8a\libtensorflowlite_jni.so
lib\armeabi-v7a\libcrypto1.1.so
lib\armeabi-v7a\libffi.so
lib\armeabi-v7a\libhidapi.so
lib\armeabi-v7a\libmain.so
lib\armeabi-v7a\libpython3.8.so
lib\armeabi-v7a\libSDL2.so
lib\armeabi-v7a\libSDL2_image.so
lib\armeabi-v7a\libSDL2_mixer.so
lib\armeabi-v7a\libSDL2_ttf.so
lib\armeabi-v7a\libsqlite3.so
lib\armeabi-v7a\libssl1.1.so
lib\armeabi-v7a\libtensorflowlite_jni.so
lib\x86\libtensorflowlite_jni.so
lib\x86_64\libtensorflowlite_jni.so

As you can see in the armeabi-v7a folders are way more libraries than in the folder for the other architectures. This means that for all architectures except armv7 your app misses a large set of libraries. So you need a libsdl version that has support for other architectures than armv7.

Related