我用python和kivymd写了一个简单的应用程序,它可以在PC上工作,但不能在智能手机上工作。为了将代码转换为apk文件,我使用了google colab中的buildozer。Buildozer的详细说明,以及代码,对我来说看起来不错,所以它应该在手机上工作。我试图通过ADB检查logcat,但我不知道要找什么,从我的应用程序,调试信息和警告中有许多信息,但我不知道其中哪些是重要的,哪些是正常的。
File "/content/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/Calculator/kivymd/uix/behaviors/elevation.py", line 364, in <module>
26860 7420 I python: ModuleNotFoundError: No module named 'PIL'
26860 7420 I python: Python for android ended.
647 647 I io_stats: !@ 8,0 r 50398943 1331874748 w 21301992 207147416 d 6584221 396580196 f 0 0 iot 34055544 0 th 0 0 0 pt 0 inp 0 0 488813.237
1348 1578 W InputDispatcher: channel '84af54b org.honi.calculator/org.kivy.android.PythonActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9, fd=1119
1348 1578 E InputDispatcher: channel '84af54b org.honi.calculator/org.kivy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
1348 4563 D InputTransport: Input channel destroyed: 'ClientS', fd=1114
1348 1831 I ActivityManager: Process org.honi.calculator (pid 26860) has died: fg TOP (186,1799)
943 991 I SurfaceFlinger: id=110000 Removed Bounds for - org.honi.calculator/org.kivy.android.PythonActivity@0#0 (161)
943 991 I SurfaceFlinger: id=110001 Removed SurfaceView - org.honi.calculator/org.kivy.android.PythonActivity@d69d998@0#0 (161)
943 990 I SurfaceFlinger: id=110002 Removed Background for -SurfaceView - org.honi.calculator/org.kivy.android.PythonActivity@d69d998@0#0 (161)
834 834 I Zygote : Process 26860 exited cleanly (255)
853 853 I Sensors : batch(0) - accelerometer_sensor try to batching with 100000000
1348 2293 I WindowManager: WIN DEATH: Window{84af54b u0 org.honi.calculator/org.kivy.android.PythonActivity}
1348 2293 W InputDispatcher: Attempted to unregister already unregistered input channel '84af54b org.honi.calculator/org.kivy.android.PythonActivity (server)'
我认为问题一定是在logcat的这一部分显示出来的。有人知道怎么解决这个问题吗?
你应该看只以python开头
:
26860 7420 I python: ModuleNotFoundError: No module named 'PIL'
26860 7420 I python: Python for android ended.
因为它们是来自Kivy Application的日志
但是无论如何你应该检查buildozer。日志级别的指定文件