在kivy / kivymd中添加新屏幕时,为什么我的应用程序崩溃?

时间:2020-05-26 13:00:53

标签: kivy

我需要帮助的人。我一直在努力在Windows上正常工作,但Android App崩溃了。

任务:添加新的Screen

问题:Android应用崩溃

这是我来自py文件的代码段

class infoscreen(Screen):
    pass
class WindowManager(ScreenManager):
    screen_list=[]
    def __init__(self,**kwargs):
        super(WindowManager,self).__init__(**kwargs)
        self.add_widget(mainwin(name="home"))
        self.add_widget(infoscreen(name="infoscreen"))

这是我来自kv文件的代码段

#:import utils kivy.utils
<infoscreen>:
    GridLayout:
        cols:1
        MDToolbar:
            title: "Class XII - English"
            elevation: 0
            md_bg_color:utils.get_color_from_hex("#ea474b")
            right_action_items:[['thumb-up',lambda x:root.manager.rateus()]]

我确实运行了一个logcat来跟踪问题,但是我无法真正理解是什么导致了问题。这是我的logcat日志供参考。

05-26 18:23:04.897 24782 24823 I python  : Android kivy bootstrap done. __name__ is __main__
05-26 18:23:04.897 24782 24823 I python  : AND: Ran string
05-26 18:23:04.897 24782 24823 I python  : Run user program, change dir and execute entrypoint
05-26 18:23:04.897  3876  3876 D Launcher_UnlockAnimationStateMachine: mResetIdleStateRunnable
05-26 18:23:04.957  1487  2501 I Timeline: Timeline: Activity_windows_visible id: ActivityRecord{46b2d4e u0 com.appsheet.whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/org.kivy.android.PythonActivity t14301} time:206761857
05-26 18:23:04.959  1487  2501 I Timeline: Timeline: App_transition_stopped time:206761859
05-26 18:23:04.965  3876  3876 D Launcher.Lifecycle: onStop:UserHandle{0},ce260db,false
05-26 18:23:04.969  3876  3876 D Launcher.BackScreen: shown change, now is false, changedView=com.android.internal.policy.PhoneWindow$DecorView{d2276b6 I.ED..... R......D 0,0-1080,1920}, visi=4
05-26 18:23:05.053 24782 24823 I python  : [INFO   ] [Logger      ] Record log in /data/user/0/com.appsheet.whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/files/app/.kivy/logs/kivy_20-05-26_1.txt
05-26 18:23:05.054 24782 24823 I python  : [INFO   ] [Kivy        ] v1.11.1
05-26 18:23:05.054 24782 24823 I python  : [INFO   ] [Kivy        ] Installed at "/data/user/0/com.appsheet.whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
05-26 18:23:05.054 24782 24823 I python  : [INFO   ] [Python      ] v3.8.1 (default, May 24 2020, 00:57:41) 
05-26 18:23:05.054 24782 24823 I python  : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
05-26 18:23:05.054 24782 24823 I python  : [INFO   ] [Python      ] Interpreter at ""
05-26 18:23:05.055 24782 24823 I python  : [INFO   ] [KivyMD      ] v0.104.0
05-26 18:23:05.058 24782 24823 I python  : [INFO   ] [Factory     ] 184 symbols loaded
05-26 18:23:05.140   804   804 I MSM-irqbalance: Decided to move IRQ200 from CPU1 to CPU0
05-26 18:23:05.278 24846 24846 I subsystem_ramdump: Usage:./system/bin/subsystem_ramdump [arg1] [arg2] [arg3]
05-26 18:23:05.278 24846 24846 I subsystem_ramdump: [arg1]: (1/2) Ramdump location: 1: eMMC: /data/ramdump or 2: SD card: /sdcard/ramdump
05-26 18:23:05.278 24846 24846 I subsystem_ramdump: [arg2]: (1/0) 1: Enable RPM log / 0: Disable RPM log
05-26 18:23:05.278 24846 24846 I subsystem_ramdump: [arg3]: (1/0) 1: Enable qdss ramdump / 0: Disable qdss ramdump
05-26 18:23:05.278 24846 24846 I subsystem_ramdump:  Using default ramdump location 1: eMMC: /data/ramdump
05-26 18:23:05.278 24846 24846 I subsystem_ramdump:  Using default 0: Disable RPM log
05-26 18:23:05.278 24846 24846 I subsystem_ramdump:  Using default 0: Disable qdss ramdump
05-26 18:23:05.278 24846 24846 E subsystem_ramdump: Unable to open /dev
05-26 18:23:05.278 24846 24846 E subsystem_ramdump: Failed to find pil ramdump
05-26 18:23:05.261 24846 24846 W subsystem_ramdu: type=1400 audit(0.0:10886367): avc: denied { read } for name="/" dev="tmpfs" ino=12473 scontext=u:r:subsystem_ramdump:s0 tcontext=u:object_r:device:s0 tclass=dir permissive=0
05-26 18:23:06.001 24782 24823 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
05-26 18:23:06.071 24782 24823 I python  : [INFO   ] [Window      ] Provider: sdl2
05-26 18:23:06.103 24782 24823 E libEGL  : validate_display:255 error 3008 (EGL_BAD_DISPLAY)
05-26 18:23:06.103 24782 24823 V SDL     : setOrientation() orientation=-1 width=800 height=600 resizable=true hint=
05-26 18:23:06.109 24782 24823 I python  : [INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
05-26 18:23:06.110 24782 24823 I python  : [INFO   ] [GL          ] Backend used <sdl2>
05-26 18:23:06.110 24782 24823 I python  : [INFO   ] [GL          ] OpenGL version <b'OpenGL ES 3.1 V@139.0 (GIT@I59a6815413)'>
05-26 18:23:06.111 24782 24823 I python  : [INFO   ] [GL          ] OpenGL vendor <b'Qualcomm'>
05-26 18:23:06.111 24782 24823 I python  : [INFO   ] [GL          ] OpenGL renderer <b'Adreno (TM) 510'>
05-26 18:23:06.111 24782 24823 I python  : [INFO   ] [GL          ] OpenGL parsed version: 3, 1
05-26 18:23:06.112 24782 24823 I python  : [INFO   ] [GL          ] Texture max size <16384>
05-26 18:23:06.112 24782 24823 I python  : [INFO   ] [GL          ] Texture max units <16>
05-26 18:23:06.138 24782 24823 I python  : [INFO   ] [Window      ] auto add sdl2 input provider
05-26 18:23:06.139 24782 24823 I python  : [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
05-26 18:23:06.150 24782 24823 I python  : [INFO   ] [Text        ] Provider: sdl2
05-26 18:23:06.263 10705 10705 D wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
05-26 18:23:06.269 24782 24823 I python  : [INFO   ] [GL          ] NPOT texture support is available
05-26 18:23:06.278 10705 10705 D wpa_supplicant: CTRL-DEBUG: global_ctrl_sock-sendto: sock=11 sndbuf=212992 outq=0 send_len=48
05-26 18:23:06.877 24782 24823 I python  : [INFO   ] [Audio       ] Providers: audio_sdl2 (audio_ffpyplayer ignored)
05-26 18:23:06.888 24782 24823 I python  :  /home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/bs4/element.py:15: UserWarning: The soupsieve package is not installed. CSS selectors cannot be used.
05-26 18:23:07.281 24782 24823 I python  : [WARNING] [GL          ] Unpack subimage support is not available
05-26 18:23:07.749 24782 24823 I python  : [WARNING] Deprecated property "<VariableListProperty name=padding_y>" of object "<kivy.uix.textinput.TextInput object at 0xdb29b2c8>" was accessed, it will be removed in a future version
05-26 18:23:08.002 24782 24823 I python  : [WARNING] [Base        ] Unknown <android> provider
05-26 18:23:08.002 24782 24823 I python  : [INFO   ] [Base        ] Start application main loop
05-26 18:23:08.482 24782 24823 I python  : [INFO   ] [Base        ] Leaving application in progress...
05-26 18:23:08.483 24782 24823 I python  :  Traceback (most recent call last):
05-26 18:23:08.483 24782 24823 I python  :    File "/home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/app/main.py", line 84, in <module>
05-26 18:23:08.483 24782 24823 I python  :    File "/home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/kivy/app.py", line 855, in run
05-26 18:23:08.484 24782 24823 I python  :    File "/home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/kivy/base.py", line 504, in runTouchApp
05-26 18:23:08.484 24782 24823 I python  :    File "/home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/kivy/core/window/window_sdl2.py", line 747, in mainloop
05-26 18:23:08.484 24782 24823 I python  :    File "/home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/kivy/core/window/window_sdl2.py", line 479, in _mainloop
05-26 18:23:08.485 24782 24823 I python  :    File "/home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/kivy/base.py", line 339, in idle
05-26 18:23:08.485 24782 24823 I python  :    File "/home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/kivy/clock.py", line 591, in tick
05-26 18:23:08.485 24782 24823 I python  :    File "kivy/_clock.pyx", line 384, in kivy._clock.CyClockBase._process_events
05-26 18:23:08.486 24782 24823 I python  :    File "kivy/_clock.pyx", line 414, in kivy._clock.CyClockBase._process_events
05-26 18:23:08.486 24782 24823 I python  :    File "kivy/_clock.pyx", line 412, in kivy._clock.CyClockBase._process_events
05-26 18:23:08.486 24782 24823 I python  :    File "kivy/_clock.pyx", line 154, in kivy._clock.ClockEvent.tick
05-26 18:23:08.487 24782 24823 I python  :    File "kivy/_clock.pyx", line 86, in kivy._clock.ClockEvent.get_callback
05-26 18:23:08.487 24782 24823 I python  :    File "/home/chit/Documents/KivyApps/Class12Apps/iTutorGurgaon/12/english/NEW/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/whitelabel.guid_e5e072fb_9d94_41bd_b636_3dfc709e706e/kivy/weakmethod.py", line 56, in is_dead
05-26 18:23:08.488 24782 24823 I python  :  ReferenceError: weakly-referenced object no longer exists
05-26 18:23:08.488 24782 24823 I python  : Python for android ended.
05-26 18:23:08.984  1487  1497 D GraphicsStats: Buffer count: 4

请协助!

0 个答案:

没有答案