如何在kivy plyer振动android测试apk中修复'jnius.jnius.JavaException'(使用buildozer编译)

时间:2019-04-17 14:48:35

标签: android kivy pyjnius

我不会用kivy测试plyer库,而是尝试测试一个简单的android振动。 该应用程序以以下日志结尾:

04-17 23:49:40.292 15287 15340 I python  :    File "jnius/jnius_export_class.pxi", line 1034, in jnius.jnius.JavaMultipleMethod.__call__
04-17 23:49:40.292 15287 15340 I python  :  jnius.jnius.JavaException: No methods matching your arguments, available: [u'(ILjava/lang/String;[JILandroid/media/AudioAttributes;)V', u'(ILjava/lang/String;JLandroid/media/AudioAttributes;)V']
04-17 23:49:40.292 15287 15340 I python  : Python for android ended.

这是一个简单的Kivy Player振动测试

Ubuntu 18.04-Kivy v1.10.1-Python v2.7.15rc1-plyer-1.4.0-Buildozer 0.39-cython-0.29.7-pyjnius-1.2.0

__version__ = '1.0'

import kivy

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button

from plyer import vibrator

class TestApp(App):

    def build(self):
        bl = BoxLayout()
        btn = Button(text='Vibrate')
        bl.add_widget(btn)
        btn.bind(on_press=self.callback)
        return bl

    def callback(instance, value):
        vibrator.vibrate(10)

buildozer.spec

requirements = kivy, python2
android.permissions = VIBRATE

我希望有一个简单的Android手机能够振动

0 个答案:

没有答案