python-for-android: Cant start service app
From @Fogapod on April 28, 2017 17:1
Versions
- Python: 2.7
- OS: android
- Kivy: master
Description
Service app raises android error right after starting. No exceptions, no kivy logs. Just do not start. Faced this problem only on android building with buildozer’s android_new toolchain
Code
I get code from here: https://github.com/tshirtman/kivy_service_osc
(changed line 7 and 8 to from kivy import platform)
Logs
Part of logcat where app fails to start service
Edit: removed apk.
Copied from original issue: kivy/kivy#5140
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 26 (14 by maintainers)
Commits related to this issue
- Sets default service pythonName, fixes #1049 In https://github.com/kivy/python-for-android/pull/609 `PYTHON_NAME` was being used while potentially null (in the case of basic service folder method), l... — committed to AndreMiras/python-for-android by AndreMiras 6 years ago
- Merge pull request #1371 from AndreMiras/feature/ticket1049_fix_android_service_crash Sets default service pythonName, fixes #1049 — committed to kivy/python-for-android by tito 6 years ago
Seems like the bug was introduced in https://github.com/kivy/python-for-android/pull/609 Basically the
pythonNameis not initialised within PythonActivity.java start_service(). To fix it we could either initialise it here, or check in start.c Java_org_kivy_android_PythonService_nativeStart() ifpython_nameis null and assign it a default value. I vote for the first option which is to assign it a default value in thePythonActivity.javafile. I’ll provide a pull request later.@AndreMiras strlen+71 and “fault addr 0x0” indicate a strlen on a null char pointer. If you compiled with sdl2 bootstrap, it’s located in https://github.com/kivy/python-for-android/blob/764b59ec1c97b413a7c5808da9f1168f0e4a5874/pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonService.java#L134
The implementation is done at https://github.com/kivy/python-for-android/blob/764b59ec1c97b413a7c5808da9f1168f0e4a5874/pythonforandroid/bootstraps/sdl2/build/jni/src/start.c#L291
So one of theses are NULL, so passed NULL from the java i guess. If you have a environement you can play with, just log them in Java first to see which one is wrong, before going to nativeStart. It will help, and no need to recompile and debug the native part.
Thank you so much man, I finally got it to work and not crash! The problem was really stupid though. instead of org.myapp I wrote com.myapp Anyway without your help I wouldn’t have found this, Thank you 😄