-
Notifications
You must be signed in to change notification settings - Fork 54
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
ImportError: dlopen failed: cannot locate symbol "SDL_ANDROID_GetJNIEnv" #25
Comments
I have the same issue, here is some additional info if it helps: 1- Python version: 3.7 Thanks! |
I have same thing here. when using microphone on android. playback is fine. |
Changing the directory name from android/org/audiostream -> src/org/audiostream wont affect into error. actually it is same "cannot locate symbol "SDL_ANDROID_GetJNIEnv"", and this concludes the android_ext.h could not read AudioIn.java file. |
I run into the same problem. Whenever I start recording with mic, the app crashed. |
I tried changing from the source code, to try to see if the name of the Symbol was matching, it was not matching, so I changed the source code files from that Symbol error to a different one, in a way SDL2 can find it, but it did not work, the solution is to rewrite the source of the compilation of audiostream because at some point, the symbol is just getting lost and the get_input or get_output functions cannot link either |
Is anyone able to describe how to reproduce this error to see it and fix it, for visiting developers new to the systems involved? |
Hi,
from audiostream import get_input declare a callback where we'll receive the datadef callback_mic(data): get the microphone (or from another source if available)mic = get_input(callback=callback_mic) And I read the Important note: "To be able to record microphone on Android, you need to have the RECORD_AUDIO permission" So, I granted that permission. Before I create the APK, I include the "audiostream" in the requirements of the "spec" file so that I make sure audiostream module is installed into the Apk, so after I built the apk and install in my Android phone, the error is the following: Error dlopen: ... core.so So, in conclusion, something in the source code of audiostream is not updated and that is why the compilation does not include that symbol, Instead, if I use Pyjnius to load the Android Autoclass to Record sound, It is working fine and it records in High Quality, so, that is the issue, if you need the apk let me know |
EDIT: commentary deleted to clarify issue thread. Could others organise and simplify information too? It's likely possible to identify this issue, like most issues, by incrementally mutating a working case into a nonworking case, and seeing which change triggers the error. That might mean going inside python4android or audiostream to see how to relate with e.g. pyjnius. |
Thank you for your answer, in this case I have the following information: I think (me, personally) the error maybe in this source code https://github.com/kivy/audiostream/blob/master/audiostream/platform/plat_android.pyx Why? from audiostream import get_input def callback_mic(data): mic = get_input(callback=callback_mic) The apk is installed in the cellphone, I open the app and the error is: dlopen failed: cannot locate symbol "SDL_ANDROID_GetJNIEnv" referenced by "/data/data/org.test.midletname/files/app/_python_bundle/site-packages/audiostream/platform/plat_android.so"... So, it says something inside of plat_android.pxi does not locate the symbol SDL_ANDROID_GetJNIEnv, so what I did is something, I uncompressed the apk file and I extracted the plat_android.so library, and then I went to Ubuntu Linux and I listed the available Symbols from that library, I did it using the command: Using the answers from this https://stackoverflow.com/questions/34732/how-do-i-list-the-symbols-in-a-so-file#34796 page and I was able to list the Symbols inside So, an small part of the problem is that instead of having the symbol SDL_ANDROID_GetJNIEnv, that plat_android.so file, has the symbol SDL_Android_GetJNIEnv So, I went to edit all source pxi files that contains that error, and I recompiled the apk and the errors remains, but with new Symbol missing, dlopen failed: cannot locate symbol "SDL_Android_GetJNIEnv" referenced by "/data/data/org.test.midletname/files/app/_python_bundle/site-packages/audiostream/platform/plat_android.so"... And I said, okay I did it, and I recompiled the apk, but then I got an error from the MainActivity.java plus the same error for the SDL_Android_GetJNIEnv, The solution for this, that I have found and it is working is that we must use pyjnius to load the Java Class that help us to record something, The working example using pyjnius to record sound from the microphone and save it into a file is: Remember to provide the RECORD_AUDIO permission to the android device, otherwise it wont work: This is if you are using kivy or kivymd and if you already imported the necesary libraries from jnius import autoclass class clase_grabar_audio(BoxLayout):
This is a working example, I tested this from Android 6 to Android 10 and it is working, if you need more help or be part of developing software my name is Josue Carranza, from El Salvador. |
@jbsidis I'm reviewing this with goal to eventually fix it. I have severe cognitive issues and need clear notes to help me move forward. Can you edit your failing example to format the code? This will make it work when visitors copy-paste it. There are two ways:
or
|
I've identified that this issue is because of a missing check for SDL2. In SDL2, this symbol was renamed. |
Fix for one of the parts of #25: Missing symbol on android
#34 fixed this specific error and this bug should be closed. I have not tested an entire recording workflow on android at this time but am happy to make that work if somebody can write a test app. |
Hi
I tried the record_mac.py example provided. I also tried this code. The build process is fine and I have added audiostream to my requirements in buildozer.spec.
The problem I am facing is that the app crashes on the android device and logcat output is giving me the error.
Any help is appreciated.
The text was updated successfully, but these errors were encountered: