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

UnsatisfiedLinkError on some devices #14

Open
harunurhan opened this issue Sep 15, 2014 · 3 comments
Open

UnsatisfiedLinkError on some devices #14

harunurhan opened this issue Sep 15, 2014 · 3 comments

Comments

@harunurhan
Copy link

I added this library to my projects, it works properly on some devices but it does not on some others.
System.loadLibrary line, throws an exception because library cannot be loaded. I unzip the apk and check libAndroidImageFilter.so is created for all architecture.

There is no common among problematic devices. Some of them are KitKat whereas some other are JellyBean. Most of them are Samsung but there are also several HTC. Also there are a Samsung devices which does not have any crash. Furthermore, even though all of them has armv7 based cpu, there are a few armv7 based devices on which the library is able to run.

In short, I have no idea why it crashes on some devices.

@ragnraok
Copy link
Owner

Could you show the crash stack? This may be caused by the *.so library was broken or the system doesn't put it on the correct directory, so I think you can put the *.so into your apk's assets directory, when you catch UnsatisfiedLinkError, you can load the library from assets.

@harunurhan
Copy link
Author

*.so is not broken because the same apk works on some devices whereas it does not on some other.
May be the System.loadLibrary has different default library path on these devices which crash.

I tried to load library in a different way when I catch UnsatisfiedLinkError, like
System.load("/data/data/my.package/lib/libmysharedlibrary.so") this also throws UnsatisfiedLinkError. This solution also works on devices which don't crash previously, but still does not work on problematic devices.

About your suggestion, If I put my *.so into my ape's assets directory what would be the correct path to load it. Is it /data/data/my.package/assets/libmysharedlibrary.so ?

@ragnraok
Copy link
Owner

Well, you can copy the *.so into the directory like /data/data/your.package.name/recover_lib when the app is initializing, and if you catch UnsatisfiedLinkError after call System.loadLibrary as usual, you can load the library from that directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants