-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Kivy is an amazing framework and it is great that Kivy and P4A is moving forward and keeping up with the times. Unfortunately, I have been experiencing a few issues since moving from the “trusty and very stable P4A v0.6” to P4A 2019.06.06 and later.
My suspicion is that the issues might be related to SDL2 being upgraded from 2.0.4 to 2.0.9, as this seems to be the major variable that was changed from P4A 2019.06.06 onwards.
1. Severe drop in frame rate on android.
I have an app that requires moving around appx. 30-40 widgets at a fast pace. Previously (with P4A v0.6 & SDL2.0.4), I achieved 60fps without a hitch, but since the upgrade, building an apk using the exact same code the frame rate has dropped to less than 20fps.
Could this be SDL2 related, or something else?
2. App crashes on exit on android.
In the past I used one of two methods to gracefully exit an app:
Method 1
App.get_running_app().stop()
Window.close()
Method 2
import stopTouchApp kivy.base.stopTouchApp
stopTouchApp()
Since P4A 2019.06.06 and later releases, the app crashes on exit using these methods or causes and ANR on android (Tested on android 5.1 and android 9 – happens about 70% of the time.)
For the time being, I managed to circumvent the issue by running the exit code on UI thread eg: (It still crashes on exit sometimes, but much less frequently) Anyone with an idea why this happens?
3. Screen irregularities on android on_start and on_pause.
Using P4A 2019.06.06 or later, I have been noticing some issues with the Window / Screen on android device. The android status bar is shown on the splash screen while the app is loading – previously this was hidden. But, more importantly there intermittently appear a 'space' or 'black bar' at the top of the screen when on_resume is called causing the screen to ‘hop’ down and up, before being restored to normal. (Previously such screen transitions happened very smoothly, and was imperceptible.)
I created a minimal kivy app example to clearly demonstrate these issues on android. Please see built environment comparison below:
Test APK: KivyBench1 (No issues)
Build environment:
- VM: 0.4
- P4A: v0.6
- Kivy: 1.10.1
- Buildozer: 0.35
- API: 27
- NDK: Crystax 10.3.2
- Arch: armeabi-v7a
Test APK: KivyBench2 (Issues 1-3 as described previously)
Build environment:
- VM: 0.5
- P4A: v2019.07.08
- Kivy: 1.11
- Buildozer: 0.39
- API: 28
- NDK: r17c
- Arch: armeabi-v7a
Both apks are built with the exact same code, but if you run a performance test with KivyBench1 (built with P4A 0.6) with 100 widgets a frame rate of 60fps is achieved. Whereas, if you run KivyBench2 (built with P4A 2019.07.08) with 100 widgets, the frame rate is way down to 15 fps. (Tested with Android 9 device: Galaxy Note 9)
I also tried variations to build KivyBench2 for example changing Kivy version, NDK versions and all new P4A versions (2019.xx.xx), but the slow performance & other issues remain present. It looks like the issues is caused by the later versions of P4A, possibly SDL2 related… You will also notice the app crashes on exit with KivyBench2.
I’m attaching the app source code & sample apk packages etc, if anyone would like to build the apks to see if they get the same results.