We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2759 - Android findLibrary() returns NULL
Summary: Android findLibrary() returns NULL
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.3
Hardware: All Android (All)
: P2 normal
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-20 06:48 UTC by Sylvain
Modified: 2014-10-24 10:02 UTC (History)
2 users (show)

See Also:


Attachments
patch messagebox (4.48 KB, patch)
2014-10-20 20:02 UTC, Sylvain
Details | Diff
extra patch (1.70 KB, patch)
2014-10-22 17:15 UTC, Sylvain
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2014-10-20 06:48:53 UTC
Very rarely, loading a shared library fails. It has always happened, and the reason is not cleared, maybe : 
- bad extracted .apk
- no more memory, ...

See https://bugzilla.libsdl.org/show_bug.cgi?id=2003 for some information.

It still currently happens to me (1 per 10.000 installation I guess) and users are not happy with that.

It would be nice to have a fallback: 

  If the "findLibrary" function throw an exception (UnsatisfiedLinkError), we could display a message box to the user : 

"Sorry an error has occurred. Please try again and/or reinstall the application."

( + displaying the exception ?)
Comment 1 Gabriel Jacobo 2014-10-20 12:41:42 UTC
Do you have a patch for this?
Comment 2 Sylvain 2014-10-20 20:02:27 UTC
Created attachment 1910 [details]
patch messagebox

Yes! 
Here's a patch to show a MessageBox when an exception occurs while loading a shared library.

Please double-check it!
Comment 3 Gabriel Jacobo 2014-10-21 14:45:16 UTC
Thanks! https://hg.libsdl.org/SDL/rev/8ebee8e28593
Comment 4 Sylvain 2014-10-21 16:59:59 UTC
Oops, two minors typos :

Cancelable would be better as "false". Otherwise, the message box can be cancel with back button.
  
  dlgAlert.setCancelable(false);

Error message:
 
  "while try" => "while trying"

Thanks!
Comment 5 Sylvain 2014-10-22 17:15:35 UTC
Created attachment 1913 [details]
extra patch

extra patch with minor modifications: 
- typo
- cancel-able set to false
- add the error message, so that the user can report it.
Comment 6 Sylvain 2014-10-22 17:16:23 UTC
Please. have a look at the extra patch. (reopen)
Comment 7 Philipp Wiesemann 2014-10-24 09:13:46 UTC
(In reply to Sylvain from comment #4)
> Oops, two minors typos :
> 
> Cancelable would be better as "false". Otherwise, the message box can be
> cancel with back button.
>   
>   dlgAlert.setCancelable(false);
> 
> Error message:
>  
>   "while try" => "while trying"
> 
> Thanks!

Fixed here:
https://hg.libsdl.org/SDL/rev/d1bf8c7a532e
https://hg.libsdl.org/SDL/rev/8f97a0f537e4
Comment 8 Sylvain 2014-10-24 09:53:22 UTC
Thanks!

Please add also the "exception message" in the error messagebox (see patch).

This messagebox is only meant for rare case.

If the issue still happens after reinstallation, it can help people to fix themselves their device and/or to report the error message.
Comment 9 Philipp Wiesemann 2014-10-24 10:02:33 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/741700a12835