Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android rare bug : FindLibrary return null #994

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

Android rare bug : FindLibrary return null #994

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Labels
wontfix This will not be worked on

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: Android (All), ARM

Comments on the original bug report:

On 2013-08-01 02:31:59 +0000, Sylvain wrote:

Hi,

this is a very rare and strange bug I got from google-play reports.
it appears only for 1 per 100 000 user I guess.

Basically FindLibrary() return null, so SDL and other Lib cannot be loaded and App won't start.

I have no idea ...

here's two stack straces :

java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1409)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1761)
at android.app.ActivityThread.access$1500(ActivityThread.java:124)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:947)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3822)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load SDL2: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:429)
at java.lang.System.loadLibrary(System.java:554)
at org.libsdl.app.SDLActivity.(SDLActivity.java:55)

More verbose stack trace has :

Caused by: java.lang.UnsatisfiedLinkError: Couldn't load SDL2 from loader dalvik.system.PathClassLoader[dexPath=/data/app/net.MyCompany.MyApp-2.apk,libraryPath=/data/app-lib/net.MyCompany.MyApp-2]: findLibrary returned null

It appears with the following phones :
CM980
Huawei-U8652
U8510
ALCATEL ONE TOUCH 918
ZTE V768
GT-S5830i
U8655-1
XT550

Thanks,

Sylvain

On 2013-08-01 02:38:14 +0000, Sam Lantinga wrote:

Maybe corrupt or incomplete installation?

On 2013-08-01 08:04:54 +0000, Gabriel Jacobo wrote:

I've seen this happen when the runtime dependencies of the SDL2.so are not met, which probably means the Android version the user has is below the minimum (which may happen if they side load the app for example, or you have the wrong setting in AndroidManifest.xml). Hard to say for sure without more information.

On 2013-08-01 16:45:33 +0000, Sylvain wrote:

Here's the little changes I did :

I modified the "AndroidManifest.xml" with the following :

I modified "project.properties"
target=android-17

I've just noticed that "default.properties" contains :
target=android-7

If it was a dependency missing I would expect the name of a function or a library. Well I don't know..

On 2013-11-06 14:27:00 +0000, Gabriel Jacobo wrote:

Do you have additional info to help track this down?

On 2013-11-06 15:07:23 +0000, Sylvain wrote:

To be optimistic, I would say it seem to appear less often. But still maybe 1 per 20000 install.

Sometimes the exception appears with a weird path see the suffix "-2" :

Caused by: java.lang.UnsatisfiedLinkError: Couldn't load SDL2 from loader dalvik.system.PathClassLoader[dexPath=/data/app/net.myapp.mygame-2.apk,libraryPath=/data/data/net.myapp.mygame/lib]: findLibrary returned null

Once I also got this one :

Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: get_lib_extents[760]: 73 - /mnt/asec/net.myapp.mygame-1/lib/libSDL2_mixer.so is not a valid ELF object
at java.lang.Runtime.loadLibrary(Runtime.java:434)
at java.lang.System.loadLibrary(System.java:554)
at org.libsdl.app.SDLActivity.(SDLActivity.java:57)

(Notice that libSD2_mixer is loaded after libSDL2! so why this occured only for mixer and not for SDL2 ??)

Also, I got (recently : 1 sept. 2013) :

java.lang.UnsatisfiedLinkError: Native method not found: org.libsdl.app.SDLActivity.onNativeSurfaceChanged:()V
at org.libsdl.app.SDLActivity.onNativeSurfaceChanged(Native Method)
at org.libsdl.app.SDLSurface.surfaceChanged(SDLActivity.java:518)
at android.view.SurfaceView.updateWindow(SurfaceView.java:591)
at android.view.SurfaceView.access$000(SurfaceView.java:83)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:177)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:726)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2086)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1127)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4650)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:747)
at android.view.Choreographer.doCallbacks(Choreographer.java:567)
at android.view.Choreographer.doFrame(Choreographer.java:536)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:733)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:4987)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)

(and also today only : java.lang.UnsatisfiedLinkError: onNativeSurfaceChanged)

Notice that it always only appears maybe 1 per 20.000 install ! With severals apps.
All my apps have no obvious bug :). Valgrind cleaned (on linux, I did not tried on device). It compiles with no warning, with many compilers (gcc,clang, and winrt/windows8). I dont use opengl directly, but only the sdl renderer.
I think I have the option -fno-rtti and I dont use the dynamic cast.

I used to compile with ndk-9, but will switch to ndk-9b.
I plan to release a new game in a couple of days.

Tell me if you need more information.

On 2013-11-06 16:18:52 +0000, Gabriel Jacobo wrote:

The onNativeSurfaceChanged error could happen if you mismatched the SDLActivity.java file with the wrong libSDL2.so file. It ought to be consistent though (several reports from everyone that tries your app).

As it is, I'm inclined to mark this as "won't fix", there's stuff involved in this that we can't do anything about (funky Android distros, low memory/disk space situations?) even if we can figure out what the actual problem is.

On 2013-11-06 16:38:22 +0000, Sylvain wrote:

No problem to mark this as "won't fix", I totally understand the lack of information and reproduction steps.

On 2013-11-11 22:27:11 +0000, Gabriel Jacobo wrote:

Marking as WONTFIX for reasons stated above. Thanks for the feedback !

On 2013-11-20 08:16:23 +0000, Sylvain wrote:

I Just add more information about this issue ...

  • Problem still happening with a new application. so using the latest version of SDL.

  • For this release, I build all the different abi (arm,arm-v7a,x86,mips) in different .apk and it is still happening.

  • I made only 1 version of the application. So the problem is not while "upgrading" the application.

  • phones are :

hwy210-0151
Galaxy Ace (GT-S5830)
yecon75_tb_ics
hexing77_ics2
Wildfire S (marvel)
hwy210-0151
ZTE V793 (P175A60)

On 2013-12-05 23:00:53 +0000, Sylvain wrote:

Created attachment 1482
new findlibrary with extraction of .so from .apk

On 2013-12-05 23:01:53 +0000, Sylvain wrote:

Hello,

here a few links of people having 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

https://code.google.com/p/android/issues/detail?id=35962

And for information, here is also a patch where I try to extract the libs from the .apk (if the usual load library path fails).
It seems to work as I stop getting those "UnsatisfiedLinkError" since I use it !

Thanks,

Sylvain

@SDLBugzilla SDLBugzilla added bug wontfix This will not be worked on labels Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant