# Android: dlopen fails to open my .so files

**URL:** <https://discourse.libsdl.org/t/android-dlopen-fails-to-open-my-so-files/26071>\
**Category:** SDL Development\
**Created:** [April 22, 2019, 7:18am UTC](https://discourse.libsdl.org/t/android-dlopen-fails-to-open-my-so-files/26071 "2019-04-22T07:18:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zingam](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@Zingam](https://discourse.libsdl.org/u/Zingam)\
**Post date:** [April 22, 2019, 7:18am UTC](https://discourse.libsdl.org/t/android-dlopen-fails-to-open-my-so-files/26071/1 "2019-04-22T07:18:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AntTheAlchemist](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/antthealchemist/32/3894_2.png) [@AntTheAlchemist](https://discourse.libsdl.org/u/AntTheAlchemist)\
**Post date:** [April 22, 2019, 2:32pm UTC](https://discourse.libsdl.org/t/android-dlopen-fails-to-open-my-so-files/26071/2 "2019-04-22T14:32:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Zingam](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@Zingam](https://discourse.libsdl.org/u/Zingam)\
**Post date:** [April 22, 2019, 6:48pm UTC](https://discourse.libsdl.org/t/android-dlopen-fails-to-open-my-so-files/26071/3 "2019-04-22T18:48:47Z")

</div>

This appears to be an implementation issue: [https://github.com/android-ndk/ndk/issues/929](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.

---

<div class="post-metadata">

**Author:** ![atlas](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/0ea827/32.png) [@atlas](https://discourse.libsdl.org/u/atlas)\
**Post date:** [April 22, 2019, 8:02pm UTC](https://discourse.libsdl.org/t/android-dlopen-fails-to-open-my-so-files/26071/4 "2019-04-22T20:02:48Z")

</div>

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
