Issue
so I'm having weird troubles running an app which uses native opengl libraries. It worked before, but now the app crashes on launch. Really stumped at what causes this.
It fails to load libnativeegl.so
with an UnsatisfiedLink error, caused by an out-of-memory error. It says it could not load the library because it tried to allocate something like 800MB memory for it which seems a lot. So
I don't know much about this, but shouldn't it link against a library which is already on the machine? I don't know why it's trying to allocate this memory. Baseless speculation there.
So something went bad with linking to the library?
In the gradle build file, I have this:
ndk {
moduleName "nativeegl"
ldLibs "log", "android", "EGL", "GLESv1_CM"
}
And in the MainActivity, I load these things like so:
static {
System.loadLibrary("nativeegl");
}
This is taken directly from here: https://github.com/tsaarni/android-native-egl-example
As I said, it worked before. Last night I installed a Java update on my dev machine (Version 8 Update 71). Maybe this is Android Studio failing with this update...?
edit: the nativeegl-example still runs (after tweaking some project settings) - probably something wrong with my project...
Solution
turns out, I had accidentally increased static memory allocation in the C++ parts of my app to a ridiculous amount, and did not suspect that this was the case. It was a really silly mistake.
So the out-of-memory error was correct, this was not some strange JNI bug as I suspected. If anyone runs into an issue like this, make sure to check your memory usage.
Answered By - spinalwrap
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.