找不到kivy jnius类

2024-04-26 01:40:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我搜索kivy蓝牙的例子,找到这些代码,并复制粘贴,但没有工作。我该怎么做才能解决这个问题。谢谢。在

版本:

python:2.7

基维:1.9

jnius:1.0.2

来源:https://gist.github.com/tito/7432757

错误消息:

Traceback (most recent call last):
  File "/home/frank/workspace/798/bluetooth.py", line 13, in <module>
    BluetoothAdapter = autoclass('android.bluetooth.BluetoothAdapter')
  File "/home/frank/package/kivyPython2Venv/local/lib/python2.7/site-packages/jnius/reflect.py", line 106, in autoclass
    c = find_javaclass(clsname)
  File "jnius_export_func.pxi", line 23, in jnius.find_javaclass (jnius/jnius.c:7190)
jnius.JavaException: Class not found 'android/bluetooth/BluetoothAdapter'

在蓝牙.py在

^{pr2}$

Tags: frankinpyhomelinefind例子file
1条回答
网友
1楼 · 发布于 2024-04-26 01:40:08

如果使用Qpython,还必须导入Kivy,因为PyJnius只是Kivy的一部分。在这种情况下,使用:

#qpy:kivy
from jnius import autoclass

如果您用Py4A编译了自己的发行版,我认为您在编译它时出错了。在

相关问题 更多 >