Android : UnsatisfiedLinkError findlibrary return null

Hello,

While using SDL2 on Android, I got a few reports in the google play console
of “findlibrary return null”.
This is strange as it works for most of the users, only 1 per 10000 seems
to have the problem :

at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load SDL2:
findLibrary returned null

I am wondering if some of you gets also this error ?

I have already excluded the followings :

  • it’s not a problem of missing ABI, or a lib not in the apk.
  • not a problem of updating (it happens even on the first version of an
    application).

Some other does have the same problem :
https://code.google.com/p/android/issues/detail?id=59420

I opened a ticket on bugzilla :
https://bugzilla.libsdl.org/show_bug.cgi?id=2003

And I also put a patch of SDLActivity.java with a more robust for loading
libraries :
it first starts to load the library as usual, but if it fails, it extract
it from the .apk.

It seems to work for me as I stopped getting those crashes.

It would be great if someone familiar with java and android could have a
look at it !

Thanks,

Sylvain.

Cool. I will try your patch and report back. Getting a few of those
exceptions, too.Am 06.12.2013 10:07 schrieb “Sylvain Becker” <sylvain.becker at gmail.com>:

Hello,

While using SDL2 on Android, I got a few reports in the google play
console of “findlibrary return null”.
This is strange as it works for most of the users, only 1 per 10000 seems
to have the problem :

at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load SDL2: findLibrary returned null

I am wondering if some of you gets also this error ?

I have already excluded the followings :

  • it’s not a problem of missing ABI, or a lib not in the apk.
  • not a problem of updating (it happens even on the first version of an
    application).

Some other does have the same problem :
https://code.google.com/p/android/issues/detail?id=59420

http://stackoverflow.com/questions/16450035/how-can-i-make-android-delete-old-native-libraries/16683835#16683835

I opened a ticket on bugzilla :
https://bugzilla.libsdl.org/show_bug.cgi?id=2003

And I also put a patch of SDLActivity.java with a more robust for loading
libraries :
it first starts to load the library as usual, but if it fails, it extract
it from the .apk.

It seems to work for me as I stopped getting those crashes.

It would be great if someone familiar with java and android could have a
look at it !

Thanks,

Sylvain.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello,

Thanks !
It ran fine for a few days, but of course, I had to post to received an
exception …

java.lang.NullPointerException from “getFilesDir()”.

which means the script is not fully working !
It needs some more tweak, maybe trying among a list of directories to
install ? Which ones could they be ?

SylvainOn Fri, Dec 6, 2013 at 10:27 AM, M. Gerhardy <martin.gerhardy at gmail.com>wrote:

Cool. I will try your patch and report back. Getting a few of those
exceptions, too.
Am 06.12.2013 10:07 schrieb “Sylvain Becker” <@Sylvain_Becker>:

Hello,

While using SDL2 on Android, I got a few reports in the google play
console of “findlibrary return null”.
This is strange as it works for most of the users, only 1 per 10000 seems
to have the problem :

at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load SDL2: findLibrary returned null

I am wondering if some of you gets also this error ?

I have already excluded the followings :

  • it’s not a problem of missing ABI, or a lib not in the apk.
  • not a problem of updating (it happens even on the first version of an
    application).

Some other does have the same problem :
https://code.google.com/p/android/issues/detail?id=59420

http://stackoverflow.com/questions/16450035/how-can-i-make-android-delete-old-native-libraries/16683835#16683835

I opened a ticket on bugzilla :
https://bugzilla.libsdl.org/show_bug.cgi?id=2003

And I also put a patch of SDLActivity.java with a more robust for loading
libraries :
it first starts to load the library as usual, but if it fails, it extract
it from the .apk.

It seems to work for me as I stopped getting those crashes.

It would be great if someone familiar with java and android could have a
look at it !

Thanks,

Sylvain.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Sylvain Becker

slvn wrote:

Hello,
It ran fine for a few days, but of course, I had to post to received an exception …?

java.lang.NullPointerException from “getFilesDir()”.?

How many applications you have installed on this device? How many of them are installed on external card? Did you install any additional app lately? Or moved between device/external SD card?

I had similar problems on my tablet loaded with lots of applications for years. As I found out, there is (was?) a limit of number of applications which could be installed (mounted?) at the same time. As I found out, as soon as I installed N+1 application, some of the existing applications started erroring, because their “data” filesystem was not mounted anymore.
I verified that by opening a console, and calling “df” - there should be one mount point for each applications.
The “solution” was to uninstall some unneeded applications and reboot the system. I think the limit was then at 50 - don’t remember if those were 50 “on device” or 50 “moved to external card” - probably the latter.

Anyways, it looks like your error comes from the fact that the directory which should be accessible, is not, for whatever reason (broken filesystem, broken SD card, no free space, no access rights etc.). But that is only a guess.

This is not my device, only one user in the cloud.
There was more than 100.000 updates, and only one pb with “getFilesDir()“
If you look at the patch, “getFilesDir()” is only used if the usual
"System.loadLibrary()” path does not success.
I would have expected 10 or 20 “findLibrary()”…but I got only 1
"getFilesDir()”.

My AndroidManifest is configured with "android:installLocation=“auto”.On Fri, Dec 6, 2013 at 1:09 PM, miko wrote:

slvn wrote:

Hello,

It ran fine for a few days, but of course, I had to post to received an
exception …

java.lang.NullPointerException from “getFilesDir()”.

How many applications you have installed on this device? How many of them
are installed on external card? Did you install any additional app lately?
Or moved between device/external SD card?

I had similar problems on my tablet loaded with lots of applications for
years. As I found out, there is (was?) a limit of number of applications
which could be installed (mounted?) at the same time. As I found out, as
soon as I installed N+1 application, some of the existing applications
started erroring, because their “data” filesystem was not mounted anymore.
I verified that by opening a console, and calling “df” - there should be
one mount point for each applications.
The “solution” was to uninstall some unneeded applications and reboot the
system. I think the limit was then at 50 - don’t remember if those were 50
"on device" or 50 “moved to external card” - probably the latter.

Anyways, it looks like your error comes from the fact that the directory
which should be accessible, is not, for whatever reason (broken filesystem,
broken SD card, no free space, no access rights etc.). But that is only a
guess.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Sylvain Becker