Issue with Permissions and App Crashes on Android 13

809 views
Skip to first unread message

Abdu Moez

unread,
Sep 23, 2023, 9:28:28 AM9/23/23
to Kivy users support
Hi
I'm facing a critical issue with my Kivy-based Android app, and I hope you can help me resolve it. Here's a brief overview of the problem:

1. Permissions Issue on Android 13: I have implemented a permission system in my app using the Android Permissions module. It has been working fine on Android versions up to 12, but on Android 13, the app doesn't ask for permissions, causing it to crash later.

2. Crash on Main Page (Android 12 and lower): On Android versions up to 12, even after granting permissions, the app crashes when navigating to the main screen. This issue doesn't occur on Windows.

3. Buildozer Logs and Configuration: I've included relevant portions of my Buildozer logs and the Buildozer.spec file for your reference.

4. Development Environment:
Python Version: 3.10.12
Buildozer Version: 1.5.0

5. I also attached the file for getting android permissions
android_permissions.py
buildozer.spec
buildozer_logs.txt

Abdu Moez

unread,
Sep 23, 2023, 9:36:35 AM9/23/23
to Kivy users support
Also the adb logs are attached here.
android_adb_13_logs.txt
android_adb_10_logs.txt

Robert

unread,
Sep 23, 2023, 1:01:42 PM9/23/23
to Kivy users support
1) This is possibly your Android 13 issue

https://github.com/Android-for-Python/Android-for-Python-Users#storage-permissions

2) Android <= 12 issue

>  when navigating to the main screen
Not really actionable info.

>  It has been working fine on Android versions up to 12,
This from issue 1) seems to be a contradiction.
What else changed?

There is no Python "traceback" in the Android 10 logcat so perhaps the crash is in Android?
So unfilter the log :
https://github.com/Android-for-Python/Android-for-Python-Users#get-an-error-message
Particularly search for "backtrace" or "crash" or "tombstone"

Abdu Moez

unread,
Sep 23, 2023, 2:29:19 PM9/23/23
to kivy-...@googlegroups.com
For the second issue on Android devices up to version 12:

The app opens and asks for permission, which we grant. Then it opens the splash screen. After 2 seconds, it transitions to the main screen. However, after a second, the main screen pops up and the app crashes immediately afterwards. Surprisingly, there are no error or warning messages in the logs. I am unsure why this is happening.

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/izeVTB6NdIo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/27bf9ba0-d321-4494-a157-3bd14d1aa243n%40googlegroups.com.

Robert

unread,
Sep 23, 2023, 3:53:41 PM9/23/23
to Kivy users support
But it used to work, right? 
What changed?

Did you try un-filtering the log, as described above?

Does it now work on Android 13?

Abdu Moez

unread,
Sep 25, 2023, 12:52:35 PM9/25/23
to Kivy users support

Apologies for the delayed response. Here's the updated status regarding the errors:
I utilized the following command to identify these error logs (on Windows):

> adb logcat | findstr /C:"crash" /C:"I python" /C:"backtrace" /C:"tombstone"

I'd like to clarify that the previous clash pertained to logs from Android 11 on a OnePlus device. I've included two sets of logs, one with filters and the other without.

Regarding the first issue on Android 13, it has been resolved, and, surprisingly, the application no longer experiences crashes on Android 13. Additionally, the permission handling is functioning perfectly. Thank you for your assistance in this matter.

I've attached a new permission file and logs from the Android 11 crash along with this message.
android_permissions.py
android_11_filtered_more_adb_logs.txt
android_11_non_filtered_more_adb_logs.txt

Robert

unread,
Sep 25, 2023, 3:27:29 PM9/25/23
to Kivy users support

Abdu Moez

unread,
Sep 25, 2023, 3:58:33 PM9/25/23
to Kivy users support
It seems like my issue hasn't been resolved through the link you provided. Would it be advisable to downgrade to KivyMD version 1.0.2 as a potential solution?

Abdu Moez

unread,
Sep 25, 2023, 4:01:44 PM9/25/23
to Kivy users support
But now when i downgrade to kiymd==1.0.2
I get this error

[INFO   ] [Base        ] Start application main loop
[INFO   ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\main.py", line 557, in <module>
     NetworkingToolsApp().run()
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivy\app.py", line 956, in run
     runTouchApp()
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivy\base.py", line 574, in runTouchApp
     EventLoop.mainloop()
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivy\base.py", line 339, in mainloop
     self.idle()
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivy\base.py", line 379, in idle
     Clock.tick()
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivy\clock.py", line 733, in tick
     self.post_idle(ts, self.idle())
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivy\clock.py", line 776, in post_idle
     self._process_events()
   File "kivy\_clock.pyx", line 620, in kivy._clock.CyClockBase._process_events
   File "kivy\_clock.pyx", line 653, in kivy._clock.CyClockBase._process_events
   File "kivy\_clock.pyx", line 649, in kivy._clock.CyClockBase._process_events
   File "kivy\_clock.pyx", line 218, in kivy._clock.ClockEvent.tick
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivymd\uix\button\button.py", line 1290, in set__radius
     self.rounded_button = True
     ^^^^^^^^^^^^^^^^^^^
   File "kivy\properties.pyx", line 520, in kivy.properties.Property.__set__
   File "kivy\properties.pyx", line 567, in kivy.properties.Property.set
   File "kivy\properties.pyx", line 606, in kivy.properties.Property._dispatch
   File "kivy\_event.pyx", line 1307, in kivy._event.EventObservers.dispatch
   File "kivy\_event.pyx", line 1213, in kivy._event.EventObservers._dispatch
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivymd\uix\button\button.py", line 894, in set_radius
     self._radius = self.height / 2
     ^^^^^^^^^^^^
   File "kivy\properties.pyx", line 520, in kivy.properties.Property.__set__
   File "kivy\properties.pyx", line 567, in kivy.properties.Property.set
   File "kivy\properties.pyx", line 606, in kivy.properties.Property._dispatch
   File "kivy\_event.pyx", line 1307, in kivy._event.EventObservers.dispatch
   File "kivy\_event.pyx", line 1213, in kivy._event.EventObservers._dispatch
   File "kivy\_event.pyx", line 748, in kivy._event.EventDispatcher.__proxy_setter
   File "kivy\properties.pyx", line 567, in kivy.properties.Property.set
   File "kivy\properties.pyx", line 606, in kivy.properties.Property._dispatch
   File "kivy\_event.pyx", line 1307, in kivy._event.EventObservers.dispatch
   File "kivy\_event.pyx", line 1213, in kivy._event.EventObservers._dispatch
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivymd\uix\behaviors\elevation.py", line 1060, in _update_shadow
     self.draw_shadow()(
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\kivymd\uix\behaviors\elevation.py", line 1222, in __draw_shadow__
     context.rectangle(
   File "E:\LinuxData\Documents\Apps\CleanJaraTool\.venv\Lib\site-packages\PIL\ImageDraw.py", line 292, in rectangle
     self.draw.draw_rectangle(xy, fill, 1)
 ValueError: x1 must be greater than or equal to x0

Robert

unread,
Sep 25, 2023, 4:36:17 PM9/25/23
to Kivy users support
I don't know much about KivMD, and nothing about its versions and there dependencies.

But I notice in the link I shared,  the link to the KivyMd isntructions was broken
It is now https://github.com/kivymd/KivyMD#how-to-fix-a-shader-bug-on-an-android-device

berk berk

unread,
Sep 25, 2023, 6:58:27 PM9/25/23
to Kivy users support
KivyMD dependence is "Pillow"  *pillow need for color class. 
in buildezer use like; kivy,kivymd,pillow
*kivy>=2.0.0

25 Eylül 2023 Pazartesi tarihinde saat 23:36:17 UTC+3 itibarıyla Robert şunları yazdı:

berk berk

unread,
Sep 25, 2023, 7:05:31 PM9/25/23
to Kivy users support
But i see now, you used in buildozer.spec. you should try manually put in apk file.  kivymd(your current library in computer)  copy than paste your .buildozer/android/platform/dist/bundle/.../sitepackes/kivymd
[*]But i'm sure kivymd normally works well. this is just manual way.

26 Eylül 2023 Salı tarihinde saat 01:58:27 UTC+3 itibarıyla berk berk şunları yazdı:
Reply all
Reply to author
Forward
0 new messages