Plyer通知在Android上不起作用

时间:2020-11-09 16:09:31

标签: python android kivy buildozer

我正在尝试编写一个简单的应用程序,以接收消息并显示通知,除该通知外,其他一切都正常。
此外,如果我在Windows上运行该应用程序,则可以正确显示通知
我在android 10上运行该应用程序

我用于通知的代码是:

from plyer import notification
notification.notify(title="Notification", message=message)

当我在手机(adb logcat)上运行应用程序时收到此错误:

'P4A_NUMERIC_VERSION': 'None', 'P4A_MINSDK': '21', 'LC_CTYPE': 'C.UTF-8'})
11-09 16:18:15.526 10656 16558 I python  : Android kivy bootstrap done. __name__ is __main__
11-09 16:18:15.526 10656 16558 I python  : AND: Ran string
11-09 16:18:15.526 10656 16558 I python  : Run user program, change dir and execute entrypoint
11-09 16:18:15.598 10656 16558 I python  : [WARNING] [Config      ] Older configuration version detected (0 instead of 21)
11-09 16:18:15.598 10656 16558 I python  : [WARNING] [Config      ] Upgrading configuration in progress.
11-09 16:18:15.601 10656 16558 I python  : [INFO   ] [Logger      ] Record log in /data/user/0/org.foo.foo/files/app/.kivy/logs/kivy_20-11-09_0.txt
11-09 16:18:15.601 10656 16558 I python  : [INFO   ] [Kivy        ] v1.11.1
11-09 16:18:15.601 10656 16558 I python  : [INFO   ] [Kivy        ] Installed at "/data/user/0/org.foo.foo/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
11-09 16:18:15.601 10656 16558 I python  : [INFO   ] [Python      ] v3.8.1 (default, Nov  8 2020, 16:20:13)
11-09 16:18:15.601 10656 16558 I python  : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
11-09 16:18:15.602 10656 16558 I python  : [INFO   ] [Python      ] Interpreter at ""
11-09 16:18:16.063 10656 16558 I python  : [INFO   ] [Factory     ] 184 symbols loaded
11-09 16:18:16.225 10656 16558 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
11-09 16:18:16.254 10656 16558 I python  : [INFO   ] [Text        ] Provider: sdl2
11-09 16:18:16.344 10656 16558 I python  : [INFO   ] [Window      ] Provider: sdl2
11-09 16:18:16.369 10656 16558 I python  : [INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
11-09 16:18:16.371 10656 16558 I python  : [INFO   ] [GL          ] Backend used <sdl2>
11-09 16:18:16.371 10656 16558 I python  : [INFO   ] [GL          ] OpenGL version <b'OpenGL ES 3.2 v1.r19p0-01rel0.###other-sha0123456789ABCDEF0###'>
11-09 16:18:16.371 10656 16558 I python  : [INFO   ] [GL          ] OpenGL vendor <b'ARM'>
11-09 16:18:16.371 10656 16558 I python  : [INFO   ] [GL          ] OpenGL renderer <b'Mali-G76'>
11-09 16:18:16.372 10656 16558 I python  : [INFO   ] [GL          ] OpenGL parsed version: 3, 2
11-09 16:18:16.372 10656 16558 I python  : [INFO   ] [GL          ] Texture max size <8192>
11-09 16:18:16.372 10656 16558 I python  : [INFO   ] [GL          ] Texture max units <16>
11-09 16:18:16.388 10656 16558 I python  : [INFO   ] [Window      ] auto add sdl2 input provider
11-09 16:18:16.388 10656 16558 I python  : [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
11-09 16:18:16.446 10656 16558 I python  : [INFO   ] [GL          ] NPOT texture support is available
11-09 16:18:16.461 10656 16558 I python  : [WARNING] [Base        ] Unknown <android> provider
11-09 16:18:16.462 10656 16558 I python  : [INFO   ] [Base        ] Start application main loop
11-09 16:18:36.173 10656 16801 I python  :  Traceback (most recent call last):
11-09 16:18:36.173 10656 16801 I python  :    File "/mnt/c/Users/User/PycharmProjects/Foo/mobile_app/android_package/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/foo/plyer/utils.py", line 96, in _ensure_obj
11-09 16:18:36.173 10656 16801 I python  :    File "/mnt/c/Users/User/PycharmProjects/Foo/mobile_app/android_package/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/foo/plyer/platforms/android/notification.py", line 30, in <module>
11-09 16:18:36.174 10656 16801 I python  :    File "/mnt/c/Users/User/PycharmProjects/Foo/mobile_app/android_package/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/foo/jnius/reflect.py", line 208, in autoclass
11-09 16:18:36.175 10656 16801 I python  :    File "jnius/jnius_export_func.pxi", line 28, in jnius.jnius.find_javaclass11-09 16:18:36.175 10656 16801 I python  :  jnius.jnius.JavaException: Class not found b'org/foo/foo/R$drawable'

如果有用,我的buildozer.spec文件为:enter image description here

我真的不明白怎么了,有人可以帮我吗?

0 个答案:

没有答案