Fixed bug 4739 - Android: loading native libs, generated by bundletool (Thanks akk0rd87)
authorSylvain Becker <sylvain.becker@gmail.com>
Sat, 27 Jul 2019 20:21:42 +0200
changeset 12955131ea7dcc225
parent 12954 b7cb9ce40d01
child 12956 449d5819a84a
Fixed bug 4739 - Android: loading native libs, generated by bundletool (Thanks akk0rd87)
src/core/android/SDL_android.c
     1.1 --- a/src/core/android/SDL_android.c	Sat Jul 27 14:08:51 2019 -0300
     1.2 +++ b/src/core/android/SDL_android.c	Sat Jul 27 20:21:42 2019 +0200
     1.3 @@ -629,6 +629,17 @@
     1.4  
     1.5      library_file = (*env)->GetStringUTFChars(env, library, NULL);
     1.6      library_handle = dlopen(library_file, RTLD_GLOBAL);
     1.7 +
     1.8 +    if (!library_handle) {
     1.9 +        /* When deploying android app bundle format uncompressed native libs may not extract from apk to filesystem.
    1.10 +           In this case we should use lib name without path. https://bugzilla.libsdl.org/show_bug.cgi?id=4739 */
    1.11 +        const char *library_name = SDL_strrchr(library_file, '/');
    1.12 +        if (library_name && *library_name) {
    1.13 +            library_name += 1;
    1.14 +            library_handle = dlopen(library_name, RTLD_GLOBAL);
    1.15 +        }
    1.16 +    }
    1.17 +
    1.18      if (library_handle) {
    1.19          const char *function_name;
    1.20          SDL_main_func SDL_main;