-
Notifications
You must be signed in to change notification settings - Fork 6
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
Unable to run app #3
Comments
I haven't seen that before so I can't offer much help. SDL changed the way it loads libraries at some point and I haven't really looked more closely at what it's actually doing behind the scenes. I tried a clean build by cloning the simpleSDL project, downloading SDL 2.0.9 release sources and the app built and ran without problems. My ndk version is a bit older 18.1.5063045 but unfortunately I don't have time right now to test with the newer ones. if you are not using the SDL 2.0.9 release did you make sure to follow these instructions from the readme?:
(sources in question are in: simpleSDL/platforms/android/android-app/src/main/java/org/libsdl/app) |
Ah, thank you for pointing out the last part of the instructions. I somehow skipped it the first time I tried this and only populated the contrib folder. Now that I have the java sources copied into /android-app/... I get a slight variation of the error (note: still NDK 19):
Followed by:
The next thing I tried was downgrading my NDK to 18.1.5063045. I got a CMake error saying PkgConfig is missing. Which CMake version are you using? I appreciate the help! I'm using simpleSDL to troubleshoot my setup so I can build a different app. Currently it fails with the same runtime error. |
Hi there, My output is as follows:
I downloaded SDL as stated in the readme.txt from Any hints on how to progress on this? |
I tried building simpleSDL with the latest android SDK and NDK without problems. You said that dlopen is returning null. Are you using some additional native libs? Could this somehow be the reason:
I havent' looked if SDL already does this, but you could use dlerror mentioned in the above link to see what the reason was. |
@suikki have you also tried running it using Android Studio? |
yes |
Then there has to be an issue with my AS configuration, right? Would you kindly be able to send me your AS project? |
AS is essentially running the same gradle stuff that you can run from the command line. Are you able to build from the command line? i.e. running something like "gradlew assembleDebug" in the dir that contains gradlew Well here is the project I was using earlier to test: simpleSDL-master.zip Note that android studio creates files like "local.properties" that contain paths to my android sdk installation dir |
@suikki In my case dlopen returns null, but dlerror returns null. It is strange there is no dynamic linker error. As for my project setup vs. yours, the only thing different I saw was the gradle version: I was using 3.3.0 (yours is 3.3.2). I updated and still got the same result. Could this possibly be a difference in test device/Android OS version? I'm using an emulator running Android 9/API 28. It's simulating a Nexus 5X, though I doubt that part matters. What are you using? If it's an older OS version (e.g. <= API 23) then maybe the reason given in that blog post is why dlopen is returning null. |
@suikki FYI, I tested on a couple more virtual devices. I get the same behavior with an Android OS at 5.1 (API 22) and 6.0 (API 23). That disproves my working theory. Can you also post the APK you built? |
I deleted the android build dir when I created the zip earlier and I was just going to build again and upload the apk, but I thought I should test if it actually still works and now I'm getting the same error. Maybe I didn't do a proper clean rebuild after updating the SDK and NDK (as it was working after the update earlier). I definitely have not changed anything else and now dlopen is returning null for me too. I tried printing dlerror and enabling some library loading debug prints mentioned here: I was thinking that maybe the problem is that newer android build tools make apks that don't extract the .so files from the apk, but use the from inside the apk. And maybe that is why the loading fails: https://medium.com/androiddevelopers/smallerapk-part-8-native-libraries-open-from-apk-fc22713861ff I tried changing the value of the manifest value that is mentioned in the link, but it didn't seem to help, |
Hi there! Thanks, @suikki, for sharing this project with the world. I have also run into the same problem. It first worked and I could run the app on my phone without problems. After some fiddling around it suddenly stopped working. I first thought I had broken something but that wasn't it. Both SDL2-2.0.8 and SDL2-2.0.9 give basically the same error (with the relative and absolute library path, respectively). I am not sure, but i think there was an android studio update between it working and not working anymore. Could that be it? |
@2bt What version of Android Studio are you using? My setup (I'm still hitting the same issue):
|
I don't really know what NDK version I use. I am a total android noob. |
@2bt To find the NDK version in Android Studio:
|
Thanks, @tbrosman! It's 19.2.5345600, just like yours. |
So, did someone find a fix for this because now I'm hitting this error as well. Android Studio Version: 3.5.3 :/ |
i have the same problem. I cloned your repo and downloaded the SDL 2.0.9 source with no other changes. Your project seems to auto download NDK 20. It compiles with ./gradlew assemble and builds an apk, but it instantly quits. adb logcat shows this error.
Edit: Also does not work in the emulator |
i figured out, that this is related to the android ndk. I've tried again with android-ndk-r18b and it's working. |
I am able to build and deploy the app, but when I run it the shared object library fails to load.
In SDLActivity.SDLMain:
nativeRunMain calls dlopen, which returns a null handle and I get this error:
I checked the library name being passed in to dlopen. It definitely exists in the correct arch in the APK. I'm wondering if this is an issue with my NDK version. I'm using the latest stable (19.2.5345600) though I got the same behavior with 19.1.5304403.
Here's a gist with the readelf dump: https://gist.github.com/tbrosman/73d0118f8c5c5f4ea4df9b73b62fbd2a
Any pointers on how to debug this would be greatly appreciated!
The text was updated successfully, but these errors were encountered: