使用 Kivy/Buildozer 后,我在 Android 上打开我的应用程序时遇到问题
I have problems opening my app on Android after using Kivy/Buildozer
我正在开发一个最终将使用 OpenCV 的 android 应用程序项目(尚未达到该部分)。我只完成了项目的功能部分,但它在我的 Android phone (Haewai P20) 上一打开就一直崩溃。在此之前,我进行了著名的 "Hello world" 测试,显示这两个词的应用程序可以正常打开。我看了很多论坛,但找不到任何解决方案。
我正在使用 python 3.7 开发 PyCharm,当我在 Windows 上打开应用程序时,它运行良好。然后我在 VirtualBox 6.0.6.Ubuntu 18.04 上使用 buildozer。
我不想复制粘贴我所有的 logcat、buildozer.spec 和日志文件,所以您可以在这里查看它们:
buildozer.spec:
https://drive.google.com/open?id=1DHClpIxnOGKtev2nRefau85v12IzjJWm
log.txt 使用 buildozer 创建:
https://drive.google.com/open?id=1wlQmQjWH27WRef--tLPtN9FGWTE13lLL
logcat.txt(只有我安装并打开的部分):
https://drive.google.com/open?id=17ovrucpeKWpJh6MBw7e5ZUbxO3S1DSnS
我不确定到底要看什么。我感觉 Python 版本之间存在不兼容性(buildozer 使用 2.7),但我不确定如何处理。如果真的是问题的话。
如果您在打开这些文件时遇到问题以及您是否需要其他任何东西,请告诉我。
非常感谢您的帮助和时间。
如何在 logcat 中搜索错误?
使用编辑器搜索“I python”或buildozer android debug deploy run > grep "I python"
Logcat3.txt - 错误
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Logger ] Record log in /data/user/0/org.test.digitable/files/app/.kivy/logs/kivy_19-08-11_0.txt
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Kivy ] v1.11.0
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Kivy ] Installed at "/data/user/0/org.test.digitable/files/app/_python_bundle/site-packages/kivy/__init__.pyo"
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Python ] v2.7.15 (default, Aug 11 2019, 16:47:41)
08-11 17:05:10.323 7746 7801 I python : [GCC 4.2.1 Compatible Android (4691093 based on r316199) Clang 6.0.2 (https://a
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Python ] Interpreter at ""
08-11 17:05:10.324 7746 7801 I python : [WARNING] [Deprecated ] Python 2 Kivy support has been deprecated. The Kivy release after 1.11.0 will not support Python 2 anymore
08-11 17:05:10.781 7746 7801 I python : [INFO ] [Factory ] 184 symbols loaded
08-11 17:05:11.027 7746 7801 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
08-11 17:05:11.063 7746 7801 I python : [INFO ] [Window ] Provider: sdl2
08-11 17:05:11.217 7746 7801 I python : [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
08-11 17:05:11.218 7746 7801 I python : [INFO ] [GL ] Backend used <sdl2>
08-11 17:05:11.219 7746 7801 I python : [INFO ] [GL ] OpenGL version <OpenGL ES 3.2 v1.r14p0-00cet0.0416641283c5d6e2d53c163d0ca99357>
08-11 17:05:11.219 7746 7801 I python : [INFO ] [GL ] OpenGL vendor <ARM>
08-11 17:05:11.219 7746 7801 I python : [INFO ] [GL ] OpenGL renderer <Mali-G72>
08-11 17:05:11.219 7746 7801 I python : [INFO ] [GL ] OpenGL parsed version: 3, 2
08-11 17:05:11.220 7746 7801 I python : [INFO ] [GL ] Texture max size <8192>
08-11 17:05:11.220 7746 7801 I python : [INFO ] [GL ] Texture max units <16>
08-11 17:05:11.268 7746 7801 I python : [INFO ] [Window ] auto add sdl2 input provider
08-11 17:05:11.269 7746 7801 I python : [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
08-11 17:05:11.272 7746 7801 I python : Traceback (most recent call last):
08-11 17:05:11.272 7746 7801 I python : File "/home/laurent/Downloads/Files4apk/.buildozer/android/app/main.py", line 15, in <module>
08-11 17:05:11.273 7746 7801 I python : File "/home/laurent/Downloads/Files4apk/.buildozer/android/platform/build/build/python-installs/digitable/pandas/__init__.py", line 19, in <module>
08-11 17:05:11.273 7746 7801 I python : ImportError: Missing required dependencies ['numpy', 'pytz', 'dateutil']
08-11 17:05:11.273 7746 7801 I python : Python for android ended.
问题
您的 buildozer.spec 缺少依赖项 ['numpy'、'pytz'、'dateutil']
解决方案
将依赖项 ['numpy'、'pytz'、'dateutil'] 添加到 buildozer.spec
中的要求
requirements = python2,kivy,pandas,numpy,pytz,dateutil
Logcat1.txt - 错误
08-11 09:19:50.492 10715 10755 I python : [INFO ] [Logger ] Record log in /data/user/0/org.test.digitable/files/app/.kivy/logs/kivy_19-08-11_1.txt
08-11 09:19:50.492 10715 10755 I python : [INFO ] [Kivy ] v1.11.0
08-11 09:19:50.493 10715 10755 I python : [INFO ] [Kivy ] Installed at "/data/user/0/org.test.digitable/files/app/_python_bundle/site-packages/kivy/__init__.pyo"
08-11 09:19:50.493 10715 10755 I python : [INFO ] [Python ] v2.7.15 (default, Aug 10 2019, 22:32:55)
08-11 09:19:50.493 10715 10755 I python : [GCC 4.2.1 Compatible Android (4691093 based on r316199) Clang 6.0.2 (https://a
08-11 09:19:50.493 10715 10755 I python : [INFO ] [Python ] Interpreter at ""
08-11 09:19:50.494 10715 10755 I python : [WARNING] [Deprecated ] Python 2 Kivy support has been deprecated. The Kivy release after 1.11.0 will not support Python 2 anymore
08-11 09:19:50.495 10715 10755 I python : Traceback (most recent call last):
08-11 09:19:50.495 10715 10755 I python : File "/home/laurent/Downloads/Files4apk/.buildozer/android/app/main.py", line 2, in <module>
08-11 09:19:50.495 10715 10755 I python : File "/home/laurent/Downloads/Files4apk/.buildozer/android/platform/build/build/python-installs/digitable/kivy/__init__.py", line 139, in require
08-11 09:19:50.496 10715 10755 I python : Exception: The version of Kivy installed on this system is too old. (You have 1.11.0, but the application requires 1.11.1)
08-11 09:19:50.496 10715 10755 I python : Python for android ended.
问题
- 在您的 buildozer.spec 中,您指定了 Kivy 版本 1.11.1 和 Python 2 但在您的
Kivy 应用程序,(main.py),它有 1.11.0
- Python 2 Kivy 支持已被弃用。 1.11.0 之后的 Kivy 版本将不再支持 Python 2
解决方案
- 删除 main.py 中的以下内容或将其更改为
'1.11.1'
(即与 buildozer.spec 相同)
import kivy
kivy.require('1.11.0')
- 如果你想使用 Kivy 1.11.1 版本,你必须将
python2
替换为 python3
for requirements
我正在开发一个最终将使用 OpenCV 的 android 应用程序项目(尚未达到该部分)。我只完成了项目的功能部分,但它在我的 Android phone (Haewai P20) 上一打开就一直崩溃。在此之前,我进行了著名的 "Hello world" 测试,显示这两个词的应用程序可以正常打开。我看了很多论坛,但找不到任何解决方案。
我正在使用 python 3.7 开发 PyCharm,当我在 Windows 上打开应用程序时,它运行良好。然后我在 VirtualBox 6.0.6.Ubuntu 18.04 上使用 buildozer。
我不想复制粘贴我所有的 logcat、buildozer.spec 和日志文件,所以您可以在这里查看它们:
buildozer.spec:
https://drive.google.com/open?id=1DHClpIxnOGKtev2nRefau85v12IzjJWm
log.txt 使用 buildozer 创建:
https://drive.google.com/open?id=1wlQmQjWH27WRef--tLPtN9FGWTE13lLL
logcat.txt(只有我安装并打开的部分):
https://drive.google.com/open?id=17ovrucpeKWpJh6MBw7e5ZUbxO3S1DSnS
我不确定到底要看什么。我感觉 Python 版本之间存在不兼容性(buildozer 使用 2.7),但我不确定如何处理。如果真的是问题的话。
如果您在打开这些文件时遇到问题以及您是否需要其他任何东西,请告诉我。
非常感谢您的帮助和时间。
如何在 logcat 中搜索错误?
使用编辑器搜索“I python”或buildozer android debug deploy run > grep "I python"
Logcat3.txt - 错误
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Logger ] Record log in /data/user/0/org.test.digitable/files/app/.kivy/logs/kivy_19-08-11_0.txt
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Kivy ] v1.11.0
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Kivy ] Installed at "/data/user/0/org.test.digitable/files/app/_python_bundle/site-packages/kivy/__init__.pyo"
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Python ] v2.7.15 (default, Aug 11 2019, 16:47:41)
08-11 17:05:10.323 7746 7801 I python : [GCC 4.2.1 Compatible Android (4691093 based on r316199) Clang 6.0.2 (https://a
08-11 17:05:10.323 7746 7801 I python : [INFO ] [Python ] Interpreter at ""
08-11 17:05:10.324 7746 7801 I python : [WARNING] [Deprecated ] Python 2 Kivy support has been deprecated. The Kivy release after 1.11.0 will not support Python 2 anymore
08-11 17:05:10.781 7746 7801 I python : [INFO ] [Factory ] 184 symbols loaded
08-11 17:05:11.027 7746 7801 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
08-11 17:05:11.063 7746 7801 I python : [INFO ] [Window ] Provider: sdl2
08-11 17:05:11.217 7746 7801 I python : [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
08-11 17:05:11.218 7746 7801 I python : [INFO ] [GL ] Backend used <sdl2>
08-11 17:05:11.219 7746 7801 I python : [INFO ] [GL ] OpenGL version <OpenGL ES 3.2 v1.r14p0-00cet0.0416641283c5d6e2d53c163d0ca99357>
08-11 17:05:11.219 7746 7801 I python : [INFO ] [GL ] OpenGL vendor <ARM>
08-11 17:05:11.219 7746 7801 I python : [INFO ] [GL ] OpenGL renderer <Mali-G72>
08-11 17:05:11.219 7746 7801 I python : [INFO ] [GL ] OpenGL parsed version: 3, 2
08-11 17:05:11.220 7746 7801 I python : [INFO ] [GL ] Texture max size <8192>
08-11 17:05:11.220 7746 7801 I python : [INFO ] [GL ] Texture max units <16>
08-11 17:05:11.268 7746 7801 I python : [INFO ] [Window ] auto add sdl2 input provider
08-11 17:05:11.269 7746 7801 I python : [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
08-11 17:05:11.272 7746 7801 I python : Traceback (most recent call last):
08-11 17:05:11.272 7746 7801 I python : File "/home/laurent/Downloads/Files4apk/.buildozer/android/app/main.py", line 15, in <module>
08-11 17:05:11.273 7746 7801 I python : File "/home/laurent/Downloads/Files4apk/.buildozer/android/platform/build/build/python-installs/digitable/pandas/__init__.py", line 19, in <module>
08-11 17:05:11.273 7746 7801 I python : ImportError: Missing required dependencies ['numpy', 'pytz', 'dateutil']
08-11 17:05:11.273 7746 7801 I python : Python for android ended.
问题
您的 buildozer.spec 缺少依赖项 ['numpy'、'pytz'、'dateutil']
解决方案
将依赖项 ['numpy'、'pytz'、'dateutil'] 添加到 buildozer.spec
中的要求requirements = python2,kivy,pandas,numpy,pytz,dateutil
Logcat1.txt - 错误
08-11 09:19:50.492 10715 10755 I python : [INFO ] [Logger ] Record log in /data/user/0/org.test.digitable/files/app/.kivy/logs/kivy_19-08-11_1.txt
08-11 09:19:50.492 10715 10755 I python : [INFO ] [Kivy ] v1.11.0
08-11 09:19:50.493 10715 10755 I python : [INFO ] [Kivy ] Installed at "/data/user/0/org.test.digitable/files/app/_python_bundle/site-packages/kivy/__init__.pyo"
08-11 09:19:50.493 10715 10755 I python : [INFO ] [Python ] v2.7.15 (default, Aug 10 2019, 22:32:55)
08-11 09:19:50.493 10715 10755 I python : [GCC 4.2.1 Compatible Android (4691093 based on r316199) Clang 6.0.2 (https://a
08-11 09:19:50.493 10715 10755 I python : [INFO ] [Python ] Interpreter at ""
08-11 09:19:50.494 10715 10755 I python : [WARNING] [Deprecated ] Python 2 Kivy support has been deprecated. The Kivy release after 1.11.0 will not support Python 2 anymore
08-11 09:19:50.495 10715 10755 I python : Traceback (most recent call last):
08-11 09:19:50.495 10715 10755 I python : File "/home/laurent/Downloads/Files4apk/.buildozer/android/app/main.py", line 2, in <module>
08-11 09:19:50.495 10715 10755 I python : File "/home/laurent/Downloads/Files4apk/.buildozer/android/platform/build/build/python-installs/digitable/kivy/__init__.py", line 139, in require
08-11 09:19:50.496 10715 10755 I python : Exception: The version of Kivy installed on this system is too old. (You have 1.11.0, but the application requires 1.11.1)
08-11 09:19:50.496 10715 10755 I python : Python for android ended.
问题
- 在您的 buildozer.spec 中,您指定了 Kivy 版本 1.11.1 和 Python 2 但在您的 Kivy 应用程序,(main.py),它有 1.11.0
- Python 2 Kivy 支持已被弃用。 1.11.0 之后的 Kivy 版本将不再支持 Python 2
解决方案
- 删除 main.py 中的以下内容或将其更改为
'1.11.1'
(即与 buildozer.spec 相同)
import kivy
kivy.require('1.11.0')
- 如果你想使用 Kivy 1.11.1 版本,你必须将
python2
替换为python3
forrequirements