pyjnius android toast: jnius.jnius.JavaException: No methods matching your arguments
Verfasst: Dienstag 3. März 2020, 19:19
Hallo,
Ich versuche gerade mit Python und Pyjnius auf Android eine Toast-Nachricht anzuzeigen.
ich habe das Programm mit zu einer .apk compiled und sie auf meinem Handy installiert.
Nach dem die App abgestürzt ist habe ich mit den fehler gefunden:
Das ist meine main.py:
Ich hoffe mir kann jemand Helfen,
Danke im Voraus...
Ich versuche gerade mit Python und Pyjnius auf Android eine Toast-Nachricht anzuzeigen.
ich habe das Programm mit
Code: Alles auswählen
buildozer android debug
Nach dem die App abgestürzt ist habe ich mit
Code: Alles auswählen
adb logcat
Code: Alles auswählen
03-03 19:07:45.379 8367 8404 I python : Traceback (most recent call last):
03-03 19:07:45.380 8367 8404 I python : File "/data/user/0/ru.iiec.pydroid3/files/temp_iiec_codefile.py", line 9, in <module>
03-03 19:07:45.380 8367 8404 I python : Toast.makeText()
03-03 19:07:45.381 8367 8404 I python : File "jnius/jnius_export_class.pxi", line 996, in jnius.jnius.JavaMultipleMethod.__call__
03-03 19:07:45.381 8367 8404 I python : jnius.jnius.JavaException: No methods matching your arguments
03-03 19:07:45.422 8367 8404 I python : Python for android ended.
Code: Alles auswählen
jnius.jnius.JavaException: No methods matching your arguments
Code: Alles auswählen
import kivy
from android.runnable import run_on_ui_thread
from jnius import autoclass, cast
python_activity = autoclass("org.kivy.android.PythonActivity")
activity = python_activity.mActivity
current_activity = cast("android.app.Activity", activity)
toast = autoclass("android.widget.Toast")
@run_on_ui_thread
def message(text):
toast.makeText(current_activity.getApplicationContext(), str(text), toast.LENGHT_LONG).show()
message("test")
Python for android ended
Danke im Voraus...