Application crashes with linker error
denisk20 opened this issue · comments
The app crashes every time on Lenovo P780 with Android 4.2.1:
java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libgnustl_shared.so" needed by "libJniBitmapOperationsLibrary.so"; caused by load_library(linker.cpp:745): library "libgnustl_shared.so" not found
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:514)
at com.jni.bitmap_operations.JniBitmapHolder.<clinit>(JniBitmapHolder.java:15)
On genymotion with Android 4.2.2 it crashes with this error:
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_library(linker.cpp:750): library "/system/lib/libhoudini.so" not found
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:535)
at com.jni.bitmap_operations.JniBitmapHolder.<clinit>(JniBitmapHolder.java:15)
I don't understand. Why did you have an issue? It worked fine on all devices I've tried it on, and also on emulators...
Also, what is your suggestion of the fix?
Why does it need an extra file to load?
It works fine on most of devices for me too, what is posted here is a rare but 100% reproducible case for some devices and emulator configurations.
Can this be related to my gradle configuration? My gradle ndk configuration looks like this:
ndk {
moduleName "JniBitmapOperationsLibrary"
stl "gnustl_shared"
cFlags "-std=c++11 -frtti -fexceptions -pthread"
ldLibs "log", "jnigraphics"
}
@denisk20 I really have no idea how to work well with Gradle. I've a huge newb in Gradle, and all documentations of Gradle are very complex for me to learn. It's like a whole new language.
Sorry.
No worries, I'll mess around with the gradle setup, maybe there is just a
better way to configure it. If there is no such way then you may want to
consider merging the current PR (I'll decline it for now and will reopen if
I don't find anything better). I'll also submit a documentation pull
request with the description of how to setup the library in gradle if you
don't mind.
On Thu, Jan 8, 2015 at 11:53 AM, AndroidDeveloperLB <
notifications@github.com> wrote:
@denisk20 https://github.com/denisk20 I really have no idea how to work
well with Gradle. I've a huge newb in Gradle, and all documentations of
Gradle are very complex for me to learn. It's like a whole new language.—
Reply to this email directly or view it on GitHub
#13 (comment)
.
Sure. Since I've moved to Android-Studio, that would be great.
Is it possible to write using NDK/JNI on Android Studio, or is it still only possible via workarounds ?
Really? what is there to do in order for it to work? Maybe I should convert the entire library (and sample) to be used on Android Studio?
Too bad it doesn't help in coding, but Eclipse doesn't do well with C/C++ either (yet on Java&XML Eclipse is great).
That would be a really good idea. It would be even better if the library
was uploaded into maven central repository, which would require it to be a
gradle library. I'm not sure about a native android gradle library though,
never met one before. It would probably require to include binaries for all
possible architectures, taking this choice away from a developer.
I will try to experiment with it and let you know. As a minimum - yes, it
would be cool for the library to be a gradle project so that a developer
could simply run gradle assemble
to get the binaries to include into the
app.
On Thu, Jan 8, 2015 at 12:17 PM, AndroidDeveloperLB <
notifications@github.com> wrote:
Really? what is there to do in order for it to work? Maybe I should
convert the entire library (and sample) to be used on Android Studio?—
Reply to this email directly or view it on GitHub
#13 (comment)
.
So... You think I should merge this? Have you tested the library with the fix on devices that don't have this issue?
No, I have declined the pull request. I'll do some testing and will post here, will either re-open the original pull request or will create a new one with gradle-related documentation (if it appears to be a gradle config issue).
I don't understand. You mean it might be because of something else?
Sorry I can't state anything until I do deeper investigation of the issue.
I'll post the results here.
On Fri, Jan 9, 2015 at 10:00 PM, AndroidDeveloperLB <
notifications@github.com> wrote:
I don't understand. You mean it might be because of something else?
—
Reply to this email directly or view it on GitHub
#13 (comment)
.
ok thank you.
It was a bad gradle ndk config, the correct minimal config which does not require any library changes and which works reliably across the devices is
ndk {
moduleName "JniBitmapOperationsLibrary"
ldLibs "log", "jnigraphics"
}
I'm working on a documentation update pull request.
Created the PR: #16
I don't understand what's going on here.
@denisk20
Now I can't import the project on both Ecilpse and Android Studio.
What went wrong?
:(
I've done all the things that are written in the instructions...
I've made a StackOverflow here, hoping someone will succeed telling me about it:
http://stackoverflow.com/questions/27910777/c-c-file-on-jni-folder-filled-with-errors
I didn't change files layout, so it should still be valid for Eclipse (assuming that it was valid before). Sorry, I'm not an Eclipse expert, I can only talk about Android Studio. Please post the steps and error(s) that you get from Android Studio.
Did you follow the steps that I have posted with gradle PR ?
I've done both the Eclipse steps (for Eclispe), and the ones for Android Studio .
Both failed...
Now I can't use the library I've made. :(
I hate Android Studio so much for this. Why does it have to be so complex... It's a single tiny C/CPP file...
Did you follow the steps from the Pull Request?
#17
and did you do git pull
?
yes, and yes.
I think you've called "filp-horizontal" as "flip-vertical" and vice versa (at least, according to the comments)... This is how it's supposed to be:
http://converter.gomlab.com/eng/guide/rotation_flip.gom