Fixed bug 4002 - Android, nativeRunMain() fails on some phone with arm64-v8a
authorSam Lantinga <slouken@libsdl.org>
Wed, 05 Sep 2018 15:54:46 -0700
changeset 12177d9e69bf4c6d4
parent 12176 1bc855492aaf
child 12178 3136903f2edc
Fixed bug 4002 - Android, nativeRunMain() fails on some phone with arm64-v8a

Sylvain

The issue is totally reproducible on P8 Lite.

"The dlopen() call doesn't include the app's native library directory. The behavior of dlopen() by Android is not guaranteed".

Workaround in getMainSharedObject()

Just replace
return library;
with
return getContext().getApplicationInfo().nativeLibraryDir + "/" + library;
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
     1.1 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Wed Sep 05 15:28:06 2018 -0700
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Wed Sep 05 15:54:46 2018 -0700
     1.3 @@ -121,7 +121,7 @@
     1.4          } else {
     1.5              library = "libmain.so";
     1.6          }
     1.7 -        return library;
     1.8 +        return getContext().getApplicationInfo().nativeLibraryDir + "/" + library;
     1.9      }
    1.10  
    1.11      /**