Android: dlopen fails to open my .so files

I have setup a project with Gradle 5.1.1, SDL 2.0.8, FreeType. Last time was able to compile and run it was in 6 months ago. I have upgraded it yesterday to use the latest Android Studio 3.4, Gradle 5.1.1 and NDK 19.
I try to debug the project on NVIDIA SHIELD TV. The dlopen() in SDL_android.c returns a null pointer and dlerror() also returns null.

I am completely stuck.

Are you able to look at the logcat output at the point dlopen fails? It might hint to the problem, maybe something’s wrong with the native / java side?

This appears to be an implementation issue: https://github.com/android-ndk/ndk/issues/929

I am still not quite sure what to do about it. Maybe modify the sources as suggested in the link.

1 Like

I can confirm that changing find_library(ANDROID_DL_LIBRARY dl) to find_library(ANDROID_DL_LIBRARY NAMES libdl.so dl) in CMakeLists.txt works for me