APP crash with org.kivy.android.PythonActivity does not exist on adb

538 views
Skip to first unread message

Mahyar Asadi

unread,
Apr 2, 2023, 1:01:48 PM4/2/23
to Kivy users support

Hi there,

I have been trying hard the last three days to make an Android Apk from a Kivy app using Buildozer, yet I have not been successful. Kivy application (Mian.py) runs properly in Windows VS Code, and also in WSL2 Ubuntu. Buildozer creates the APK and I install it to my Samsung A32(Android 13) with no errors. The application crashes when I open the application on my phone.

I have attached the log cat of: buildozer android debug deploy run logcat > out.txt and also the Buildozer.spec. I use these libraries in my application (I have commented all the internal libraries per recommendations found in this group):

requirements = python3, kivy, numpy, jnius, kivymd, sqlite3, matplotlib

# struct, wave, random, csv, sqlite3, collections, webbrowser, math, json, six, os, io

My android SDK and NDK values:

# (int) Target Android API, should be as high as possible.

android.api = 33

# (int) Minimum API your APK / AAB will support.

android.minapi = 28

# (int) Android SDK version to use

android.sdk = 33

# (str) Android NDK version to use

android.ndk = 25

# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi.

#android.ndk_api = 21

When I use adb to debug deployment of the application, I receive the following error:

Error type 3

Error: Activity class {org.nvhtools.earthquake/org.kivy.android.PythonActivity} does not exist.

Any help is highly appreciated. Thanks.
out.zip
adb_output.txt
buildozer.spec

Robert

unread,
Apr 2, 2023, 1:11:31 PM4/2/23
to Kivy users support

Mahyar Asadi

unread,
Apr 3, 2023, 1:37:20 PM4/3/23
to Kivy users support

Hi Robert,

Thanks for your help. From the p4a documentation pages you provided what I understand is that the following error happens when at least one library is not properly addressed in buildozer.spec or its recipe is not available am I correct? I have attached the log of adb and buildozer.spec.

Error type 3 Error: Activity class {org.nvhtools.earthquake/org.kivy.android.PythonActivity} does not exist.

I did the appclean and also removed several of my application pages to simplify it but it still gives me the error on my phone (All is OK in Python either in Windows or in WSL Ubuntu log attached). I am using the following libraries in the requirement Should I uncomment any of the libraries from the commented one and add them to the requirements?

requirements = python3, kivy, numpy, jnius, kivymd, sqlite3, matplotlib,ffpyplayer, ffpyplayer_codecs,requests, urllib3, chardet, idna, certifi

# struct, wave, random, csv, sqlite3, collections, webbrowser, math, json, six, os, io, textwrap, uuid, numbers,functools

 In the attached log file I see the following prompts, should I worry about them?

[DEBUG]:             Unable to strip the following libraries, packaging them as they are: libSDL2.so, libSDL2_image.so, libSDL2_mixer.so, libSDL2_ttf.so, libavcodec.so, libavdevice.so, libavfilter.so, libavformat.so, libavutil.so, libc++_shared.so, libcrypto1.1.so, libffi.so, libfreetype.so, libmain.so, libpng16.so, libpostproc.so, libpybundle.so, libpython3.9.so, libshine.so, libsqlite3.so, libssl1.1.so, libswresample.so, libswscale.so.     

[DEBUG]:             Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

Thanks in advance.

q2.txt
buildozer.spec

Robert

unread,
Apr 3, 2023, 3:21:10 PM4/3/23
to Kivy users support

Mahyar Asadi

unread,
Apr 4, 2023, 2:20:22 PM4/4/23
to Kivy users support
Hi,
I did it but still the same following error:

Error type 3
Error: Activity class {org.nvhtools.earthquake/org.kivy.android.PythonActivity} does not exist.

I also noticed the following warning in the log, can it be the cause of the error? What normally causes this error? thanks
[DEBUG]:   > Task :stripDebugDebugSymbols

[DEBUG]:   Unable to strip the following libraries, packaging them as they are: libSDL2.so, libSDL2_image.so, libSDL2_mixer.so, libSDL2_ttf.so, libavcodec.so, libavdevice.so, libavfilter.so, libavformat.so, libavutil.so, libc++_shared.so, libcrypto1.1.so, libffi.so, libfreetype.so, libmain.so, libpng16.so, libpostproc.so, libpybundle.so, libpython3.9.so, libshine.so

Robert

unread,
Apr 4, 2023, 4:35:13 PM4/4/23
to Kivy users support
"Unable to strip" is not an issue.

Mahyar Asadi

unread,
Apr 9, 2023, 12:48:43 PM4/9/23
to Kivy users support
Hi,
I removed all of the pages and added each page of the program one by one and found out that the problem originates from the matplotlib graph object. I have created local copies of the garden.matplotlib and the error on adb logcat says:
ImportError: dlopen failed: cannot locate symbol "_ZTVSt9bad_alloc" referenced by "/data/data/com.nvhtools.earthquake/files/app/_python_bundle/site-packages/matplotlib/_path.so"...
I have attached the log file. Could you give me a hint on how to resolve this? Thanks.
adblogs.txt

Robert

unread,
Apr 9, 2023, 1:18:55 PM4/9/23
to Kivy users support
I don't know anything specific about matplotlib .

In the following matplotlib refers to the matplotlib library, not the garden_matplotlib package.
I see you have matplotlib in requirements, which is correct.

The error is a link error it can't find "bad_alloc" (or similar), other than looking in the source I got no idea what the issue is.

However this is a matplotlib  internal error, something is happening that it doesn't expect.
If is possible the matplotlib api is misused (via garden_matplotlib) from the app?

Mahyar Asadi

unread,
Apr 9, 2023, 7:00:37 PM4/9/23
to Kivy users support
I followed your instructions here (creating local copy and commenting the _path import):
https://github.com/kivy/buildozer/issues/1226#issuecomment-693109369
but still it did not work, then I thought to revert back matplotlib to the version that had worked with your instructions (Sep. 2020 ~ 3.3.1), this time buildozer did not work with the old matplotlib and the matplotlib version (3.3.7) which works with buildozer throws the following on adb:
04-10 00:46:52.553 23242 23300 I python  : [INFO   ] [Window      ] auto add sdl2 input provider
04-10 00:46:52.556 23242 23300 I python  : [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
04-10 00:46:52.985 23242 23300 I python  :  Traceback (most recent call last):
04-10 00:46:52.985 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/app/main.py", line 5, in <module>
04-10 00:46:52.986 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/app/screen_play.py", line 12, in <module>
04-10 00:46:52.986 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/app/garden_matplotlib/__init__.py", line 1, in <module>
04-10 00:46:52.986 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/app/garden_matplotlib/backend_kivy.py", line 244, in <module>
04-10 00:46:52.987 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/Earthquake/arm64-v8a/matplotlib/__init__.py", line 109, in <module>
04-10 00:46:52.987 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/Earthquake/arm64-v8a/matplotlib/rcsetup.py", line 27, in <module>
04-10 00:46:52.987 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/Earthquake/arm64-v8a/matplotlib/colors.py", line 56, in <module>
04-10 00:46:52.988 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/Earthquake/arm64-v8a/matplotlib/scale.py", line 23, in <module>
04-10 00:46:52.988 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/Earthquake/arm64-v8a/matplotlib/ticker.py", line 136, in <module>
04-10 00:46:52.988 23242 23300 I python  :    File "/home/pi/earthquake/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/Earthquake/arm64-v8a/matplotlib/transforms.py", line 46, in <module>
04-10 00:46:52.988 23242 23300 I python  :  ImportError: dlopen failed: cannot locate symbol "_ZTVSt9bad_alloc" referenced by "/data/data/com.nvhtools.earthquake/files/app/_python_bundle/site-packages/matplotlib/_path.so"...
04-10 00:46:52.989 23242 23300 I python  : Python for android ended.

Robert

unread,
Apr 9, 2023, 7:24:18 PM4/9/23
to Kivy users support
OK, I'd forgotten about that. But I don't think anybody there is seeing the issue you describe.

Robert

unread,
Apr 9, 2023, 10:09:55 PM4/9/23
to Kivy users support
I just rebuilt the app that was the source of those notes - it ran just fine.

I ask this question again:
> Is possible the matplotlib api is misused (via garden_matplotlib) from the app?

Mahyar Asadi

unread,
Apr 10, 2023, 5:16:44 AM4/10/23
to Kivy users support
Many thanks for your help, finally I could get it running with your instructions along with another recommendation to remove ccache from linux. I dropped
a line on the following pages:
https://github.com/kivy/buildozer/issues/1226
https://github.com/kivy/python-for-android/issues/2675

Robert

unread,
Apr 10, 2023, 1:15:58 PM4/10/23
to Kivy users support
How strange.
Reply all
Reply to author
Forward
0 new messages