python kivy app给出错误:“无法从'kivy.lib'导入名称'osc'”

时间:2019-02-03 10:54:47

标签: android python-3.x kivy buildozer osc

在将我的kivy应用程序编译并部署到android手机上后,当我对该应用程序启动时会收到此错误消息(该应用程序包含osc服务)。可能是什么原因?

02-03 11:10:59.839 21140 21172 I python  : [INFO   ] [Logger      ] Record log in /data/user/0/com.keinert.stayalive/files/app/.kivy/logs/kivy_19-02-03_1.txt
02-03 11:10:59.839 21140 21172 I python  : [INFO   ] [Kivy        ] v1.11.0.dev0, git-Unknown, 20190203
02-03 11:10:59.840 21140 21172 I python  : [INFO   ] [Python      ] v3.7.1 (default, Feb  3 2019, 09:58:20) 
02-03 11:10:59.840 21140 21172 I python  : [Clang 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55
02-03 11:10:59.932 21140 21172 I python  : [INFO   ] [Factory     ] 184 symbols loaded
02-03 11:11:00.428 21140 21172 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
02-03 11:11:00.544 21140 21172 I python  : [INFO   ] [Text        ] Provider: sdl2
02-03 11:11:00.581 21140 21172 I python  :  Traceback (most recent call last):
02-03 11:11:00.581 21140 21172 I python  :    File "/home/joachim/PycharmProjects/StayAlive/.buildozer/android/app/main.py", line 11, in <module>
02-03 11:11:00.583 21140 21172 I python  :  ImportError: cannot import name 'osc' from 'kivy.lib' (/data/user/0/com.keinert.stayalive/files/app/_python_bundle/site-packages/kivy/lib/__init__.pyc)
02-03 11:11:00.583 21140 21172 I python  : Python for android ended.

我不知道为什么它让我用buildozer构建apk,但是在android上运行时却失败了。

该版本列出了oscpy:

[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:     stayalive: min API 21, includes recipes (hostpython3, sdl2_image, sdl2_mixer, sdl2_ttf, python3, sdl2, six, pyjnius, kivy, oscpy, cython), built for archs (armeabi-v7a)
[INFO]:    stayalive has compatible recipes, using this one

,这是有关代码级别的信息: SDK 24 NDK 17C Android的API目标26 NDK版本17.2.4988734 Buildozer 0.38.dev0(由于suggestion而使用)

1 个答案:

答案 0 :(得分:0)

您问题的解决方案是首先将对buildozer.spec的oscpy的依赖关系添加到tshirtman的项目oscpy(https://github.com/kivy/oscpy),阅读新的API,并实现它并准备好问候。