【问题标题】:Kivy app doesn't work on android phone, although it works on the computerKivy 应用程序无法在安卓手机上运行,​​但它可以在计算机上运行
【发布时间】:2019-07-25 15:05:49
【问题描述】:

我在 debian 上使用 buildozer 制作 apk 时遇到了一些问题:当我在 debian 上启动我的应用程序时它可以工作,但是当我在我的 android 手机上启动它时,我得到了这个:

07-25 19:56:58.939 14073 14190 I python  : Android kivy bootstrap done. __name__ is __main__
07-25 19:56:58.939 14073 14190 I python  : AND: Ran string
07-25 19:56:58.939 14073 14190 I python  : Run user program, change dir and execute entrypoint
07-25 19:56:59.345 14073 14190 I python  : [WARNING] [Config      ] Older configuration version detected (0 instead of 21)
07-25 19:56:59.346 14073 14190 I python  : [WARNING] [Config      ] Upgrading configuration in progress.
07-25 19:56:59.360 14073 14190 I python  : [INFO   ] [Logger      ] Record log in /data/user/0/org.test.myapp/files/app/.kivy/logs/kivy_19-07-25_0.txt
07-25 19:56:59.361 14073 14190 I python  : [INFO   ] [Kivy        ] v1.11.0
07-25 19:56:59.362 14073 14190 I python  : [INFO   ] [Kivy        ] Installed at "/data/user/0/org.test.myapp/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
07-25 19:56:59.363 14073 14190 I python  : [INFO   ] [Python      ] v3.7.1 (default, Jul 23 2019, 20:08:31) 
07-25 19:56:59.363 14073 14190 I python  : [Clang 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55
07-25 19:56:59.365 14073 14190 I python  : [INFO   ] [Python      ] Interpreter at "android_python"
07-25 19:56:59.385 14073 14190 I python  : [ERROR  ] [Clock       ] Unable to import kivy._clock. Have you perhaps forgotten to compile kivy? Kivy contains Cython code which needs to be compiled. A missing kivy._clock often indicates the Cython code has not been compiled. Please follow the installation instructions and make sure to compile Kivy
07-25 19:56:59.387 14073 14190 I python  :  Traceback (most recent call last):
07-25 19:56:59.387 14073 14190 I python  :    File "/home/vlad/test/.buildozer/android/app/main.py", line 8, in <module>
07-25 19:56:59.389 14073 14190 I python  :    File "/home/vlad/test/.buildozer/android/platform/build/build/python-installs/myapp/kivy/app.py", line 319, in <module>
07-25 19:56:59.390 14073 14190 I python  :    File "/home/vlad/test/.buildozer/android/platform/build/build/python-installs/myapp/kivy/base.py", line 26, in <module>
07-25 19:56:59.392 14073 14190 I python  :    File "/home/vlad/test/.buildozer/android/platform/build/build/python-installs/myapp/kivy/clock.py", line 363, in <module>
07-25 19:56:59.395 14073 14190 I python  :  ImportError: dlopen failed: library "libpython2.7.so" not found
07-25 19:56:59.395 14073 14190 I python  : Python for android ended.

(日志来自 logcat)

我能做些什么来解决它?

附:这是我的 buildozer.spec:https://pastebin.com/DrVeqXt2

【问题讨论】:

  • 欢迎 Stack Overflow。您是否在计算机上安装了 Cython?根据错误消息,07-25 19:56:59.385 14073 14190 I python : [ERROR ] [Clock ] Unable to import kivy._clock. Have you perhaps forgotten to compile kivy? Kivy contains Cython code which needs to be compiled. A missing kivy._clock often indicates the Cython code has not been compiled. Please follow the installation instructions and make sure to compile Kivy .
  • @ikolim,电脑上一切正常,Cython 已安装。
  • 这与库有关。我建议您 (a) 检查 buildozer 文件中的要求,以确保您是否已添加您在应用程序中使用的所有内容,并且 (b) 如果没问题,您可能正在使用具有 C 绑定的库和在 Android 上不容易兼容,例如,如果您使用 matplotlib 或 scikit-learn 之类的库,它很可能无法在 Android 上运行。
  • @DipanshuJuneja,我用的是 paho-mqtt

标签: python android debian kivy buildozer


【解决方案1】:

我找到了解决方案 - 我刚刚使用了 vevnv 并安装了所有必要的库。

【讨论】:

    猜你喜欢
    • 2021-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多