kivy启动器立即崩溃,logcat过滤了吗?

时间:2019-03-11 16:39:15

标签: python kivy logcat

我正在尝试获取一个可以在Android手机上运行的应用程序。该应用程序在我的Macbook上运行良好。我只使用了预先安装了python或kivy的模块,但是仍然在加载图标出现在kivy启动器上后,应用立即崩溃。因此,我进行了一些挖掘,发现可以通过解锁手机上的开发人员选项并使用logcat来检查日志,但问题是,logcat吐出了很多信息供我解析。

有没有一种方法可以过滤logcat来专门为Kivy Launcher提取日志?我已经检查过所有内容,而且所有人都说您可以按应用名称过滤它,但是我尝试过

adb logcat“ application_or_tag_name:”“ :S”

例如: adb logcat“ Kivy_Launcher:”“ :S” adb logcat“ kivy_launcher:”“ :S” adb logcat“ Kivy Launcher:”“ :S”

但是它们似乎都不起作用。我已阅读以下链接:

https://logmatic.io/blog/a-how-to-guide-to-debugging-with-android-logcat/ https://developer.android.com/studio/command-line/logcat

我能够通过Android Studio获取一些日志,但是不确定这些日志是否是我为启动该程序而必须创建的“新应用”的日志,或者实际上是否是我手机上的日志?我启动了kivy启动器。这些是:

2019-03-12 01:49:32.213 4870-5048/? E/InputDispatcher: channel '8e355db org.kivy.pygame/org.renpy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2019-03-12 01:55:17.347 32697-32697/? E/org.kivy.pygam: Not starting debugger since process cannot load the jdwp agent.
2019-03-12 01:55:17.549 32697-32697/? E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/kivy/MyApp/icon.png (No such file or directory)
2019-03-12 01:55:18.968 4326-5050/? E/BufferQueueProducer: [org.kivy.pygame/org.renpy.android.ProjectChooser[32697]#0] disconnect: not connected (req=1)
2019-03-12 01:55:18.982 32733-32733/? E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/kivy/MyApp/icon.png (No such file or directory)
2019-03-12 01:55:19.833 4326-6594/? E/BufferQueueProducer: [org.kivy.pygame/org.renpy.android.PythonActivity[32733]#0] disconnect: not connected (req=1)
2019-03-12 01:55:20.873 4870-5048/? E/InputDispatcher: channel 'fda44c2 org.kivy.pygame/org.renpy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2019-03-12 01:59:52.134 1975-1975/? E/org.kivy.pygam: Not starting debugger since process cannot load the jdwp agent.
2019-03-12 01:59:52.325 1975-1975/? E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/kivy/MyApp/icon.png (No such file or directory)
2019-03-12 01:59:53.379 2044-2044/? E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/kivy/MyApp/icon.png (No such file or directory)
2019-03-12 01:59:53.421 4326-4361/? E/BufferQueueProducer: [org.kivy.pygame/org.renpy.android.ProjectChooser[1975]#0] disconnect: not connected (req=1)
2019-03-12 01:59:54.225 4326-7194/? E/BufferQueueProducer: [org.kivy.pygame/org.renpy.android.PythonActivity[2044]#0] disconnect: not connected (req=1)
2019-03-12 01:59:55.373 4870-5048/? E/InputDispatcher: channel '58b4637 org.kivy.pygame/org.renpy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2019-03-12 02:08:30.817 13936-4463/? E/MTPJNIInterface: scanFile - /storage/emulated/0/kivy/MyApp/StudentProgress3.py
2019-03-12 02:08:41.348 13936-4704/? E/MTPJNIInterface: scanFile - /storage/emulated/0/kivy/MyApp/main.py
2019-03-12 02:08:48.766 13936-4708/? E/MTPJNIInterface: scanFile - /storage/emulated/0/kivy/MyApp/StudentProgress3.py
2019-03-12 02:08:48.779 13936-4708/? E/MTPJNIInterface: scanFile - /storage/emulated/0/kivy/MyApp/main.py
2019-03-12 02:08:53.422 4813-4813/? E/org.kivy.pygam: Not starting debugger since process cannot load the jdwp agent.
2019-03-12 02:08:53.569 4813-4813/? E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/kivy/MyApp/icon.png (No such file or directory)
2019-03-12 02:08:53.873 4870-4983/? E/WindowManager: win=Window{9306df u0 Splash Screen org.kivy.pygame EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:831 com.android.server.wm.AppWindowToken.destroySurfaces:812 com.android.server.wm.WindowState.onExitAnimationDone:5221 com.android.server.wm.WindowStateAnimator.onAnimationFinished:315 com.android.server.wm.WindowState.onAnimationFinished:5633 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:92 
2019-03-12 02:08:54.926 4326-4361/? E/BufferQueueProducer: [org.kivy.pygame/org.renpy.android.ProjectChooser[4813]#0] disconnect: not connected (req=1)
2019-03-12 02:08:55.012 4849-4849/? E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/kivy/MyApp/icon.png (No such file or directory)
2019-03-12 02:08:55.864 4326-5050/? E/BufferQueueProducer: [org.kivy.pygame/org.renpy.android.PythonActivity[4849]#0] disconnect: not connected (req=1)
2019-03-12 02:08:56.613 4870-5048/? E/InputDispatcher: channel '5d9bd33 org.kivy.pygame/org.renpy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2019-03-12 02:20:58.509 7575-7575/? E/org.kivy.pygam: Not starting debugger since process cannot load the jdwp agent.
2019-03-12 02:20:58.742 7575-7575/? E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/kivy/MyApp/icon.png (No such file or directory)
2019-03-12 02:20:59.101 4870-4983/? E/WindowManager: win=Window{40e033e u0 Splash Screen org.kivy.pygame EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:831 com.android.server.wm.AppWindowToken.destroySurfaces:812 com.android.server.wm.WindowState.onExitAnimationDone:5221 com.android.server.wm.WindowStateAnimator.onAnimationFinished:315 com.android.server.wm.WindowState.onAnimationFinished:5633 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:92 
2019-03-12 02:21:01.207 4326-4361/? E/BufferQueueProducer: [org.kivy.pygame/org.renpy.android.ProjectChooser[7575]#0] disconnect: not connected (req=1)
2019-03-12 02:21:01.316 7619-7619/? E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/kivy/MyApp/icon.png (No such file or directory)
2019-03-12 02:21:02.264 4326-5050/? E/BufferQueueProducer: [org.kivy.pygame/org.renpy.android.PythonActivity[7619]#0] disconnect: not connected (req=1)
2019-03-12 02:21:03.009 4870-5048/? E/InputDispatcher: channel 'ce735e org.kivy.pygame/org.renpy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

如果有人可以帮助我,我将非常感激。我的代码如下:

from kivy.app import App
from kivy.app import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import ObjectProperty
#from kivy.uix.boxlayout import BoxLayout
#from kivy.uix.slider import Slider
import csv
import pickle

#empty_dict = {}                              # use this code if the pickle file is corrupt and needs to be reset.
#pickle_out = open("dict.pickle", "wb")
#pickle.dump(empty_dict, pickle_out)
#pickle_out.close()

class MainWindow(Screen):
    """This class will serve as the front page of the application.
    This input will be stored in a dictionary and later converted
    to a data structure using pandas and openpyxl."""

    # These variables link the python logic to the my2.kv kivy language file.
    first_name = ObjectProperty(None)
    last_name = ObjectProperty(None)
    level = ObjectProperty(None)

    # This section loads and saves the information stored from the user input.
    pickle_in = open('dict.pickle', 'rb')  # opens and assigns the opened pickle file to variable.
    student_data = pickle.load(pickle_in)  # imports the saved pickle file and assigns it to a variable.
    pickle_in.close()  # closes the pickle file for safety.

    def btn(self):
        #print(MainWindow.student_data)
        #print("First: " + self.first_name.text,
              #"Last: " + self.last_name.text)


        self.L = {self.first_name.text + ' ' + self.last_name.text: []}

        MainWindow.student_data.update(self.L)
        pickle_out = open("dict.pickle", "wb")
        pickle.dump(MainWindow.student_data, pickle_out)
        pickle_out.close()

        self.first_name.text = ''
        self.last_name.text = ''


class Controller(Screen):
    def __init__(self, **kwargs):
        super(Controller, self).__init__(**kwargs)
    def btn2(self):
        #print(self.lbl.text)
        #print(self.lbl2.text)
        #print(self.lbl3.text)
        #print(self.lbl4.text)
        #print(self.first_last.text)
        #print(self.first_last2.text)

        self.data = {self.first_last.text + ' ' + self.first_last2.text: [self.level.text, self.lbl.text, self.lbl2.text, self.lbl3.text, self.lbl4.text]}
        #print(self.data)

        # This section loads and saves the information stored from the user input.
        self.pickle_in = open('dict.pickle', 'rb')  # opens and assigns the opened pickle file to variable.
        self.loaded_data = pickle.load(self.pickle_in)  # imports the saved pickle file and assigns it to a variable.
        self.pickle_in.close()  # closes the pickle file for safety.

        #print(self.loaded_data)

        self.dictionary2 = self.data
        self.dictionary1 = self.loaded_data

        self.dictionary1.update(self.dictionary2)

        #print(self.dictionary1)

        pickle_out = open("dict.pickle", "wb")
        pickle.dump(self.dictionary1, pickle_out)
        pickle_out.close()

        self.first_last.text = ''
        self.first_last2.text = ''

    def Reading(self, *args):
        self.lbl.text = str(int(args[1]))

    def Dictation(self, *args):
        self.lbl2.text = str(int(args[1]))

    def Listening(self, *args):
        self.lbl3.text = str(int(args[1]))

    def Speaking(self, *args):
        self.lbl4.text = str(int(args[1]))




class ExporterScreen(Screen):
    def btn3(self):


        # This section loads and saves the information stored from the user input.
        self.pickle_in = open('dict.pickle', 'rb')  # opens and assigns the opened pickle file to variable.
        self.dict = pickle.load(self.pickle_in)  # imports the saved pickle file and assigns it to a variable.
        self.pickle_in.close()  # closes the pickle file for safety.

        #print(self.dict)

        temporary_row = []
        rows_list = []

        for k, v in self.dict.items():
            temporary_row.append(k)
            for i in v:
                temporary_row.append(i)
            rows_list.append(temporary_row)
            temporary_row = []

        with open('student_data.csv', 'w') as csvFile:

            writer = csv.writer(csvFile, delimiter=',')

            writer.writerow(['NAME', 'LEVEL', 'READING', 'DICTATION', 'WRITING', 'SPEAKING'])
            writer.writerows(rows_list) #the row should be ex: James, Earth, 23, 34, 45, 63

        csvFile.close()


class WindowManager(ScreenManager):
    pass


kv = Builder.load_file("my2.kv")


class MyMainApp(App):
    def build(self):
        return kv

if __name__ == "__main__":
    MyMainApp().run()

这是我的.kv代码:

WindowManager:
    MainWindow:
    Controller:
    ExporterScreen:


<MainWindow>:
    name: "main"
    first_name: first
    last_name: last


    GridLayout
        cols: 1
        size: root.width, root.height


        GridLayout:
            cols: 2

            Label:
                text: "Student First Name: "
            TextInput:
                id: first
                multiline: False

            Label:
                text: "Student Last Name: "
            TextInput:
                id: last
                multiline: False

        Button:
            size_hint: 0.3, 0.2
            text: "Submit"
            on_press: root.btn()

        FloatLayout:
            Button:
                font_size: 25
                size_hint: 0.3, 0.2
                text: ">"
                on_release:
                    app.root.current = "second"
                    root.manager.transition.direction = "left"
                pos_hint: {"right":1, "bottom": 1}

            Button:
                font_size: 25
                size_hint: 0.3, 0.2
                text: "<"
                on_release:
                    app.root.current = "third"
                    root.manager.transition.direction = "right"
                pos_hint: {"left":1, "bottom": 1}


<Controller>
    name: "second"
    lbl: my_label
    lbl2: my_label2
    lbl3: my_label3
    lbl4: my_label4
    first_last: first_last
    first_last2: first_last2
    level: level

    BoxLayout:
        orientation: 'vertical'
        Label:
            font_size: 25
            text: 'Reading'
        Label:
            id: my_label
            text: 'increase/decrease'
        Slider:
            min: 1
            max: 100
            on_value: root.Reading(*args)
        Label:
            font_size: 25
            text: 'Dictation'
        Label:
            id: my_label2
            text: 'increase/decrease'
        Slider:
            min: 1
            max: 100
            on_value: root.Dictation(*args)
        Label:
            font_size: 25
            text: 'Writing'
        Label:
            id: my_label3
            text: 'increase/decrease'
        Slider:
            min: 1
            max: 100
            on_value: root.Listening(*args)
        Label:
            font_size: 25
            text: 'Speaking'
        Label:
            id: my_label4
            text: 'increase/decrease'
        Slider:
            min: 1
            max: 100
            on_value: root.Speaking(*args)
        Label:
            text: "Level (Sky^, Sky, Earth, Rockets)"
        TextInput:
            multiline: False
            id: level

        GridLayout:
            cols:2
            Label:
                text: "First Name"
            TextInput:
                font_size: 8
                id: first_last
                multiline: False
            Label:
                text: "Last Name"
            TextInput:
                font_size: 8
                id: first_last2
                multiline: False


        GridLayout:
            cols: 3
            Button:
                text: "<"
                on_release:
                    app.root.current = "main"
                    root.manager.transition.direction = "right"
            Button:
                text: "Update"
                on_press: root.btn2()
            Button:
                text: ">"
                on_release:
                    app.root.current = "third"
                    root.manager.transition.direction = "left"


<ExporterScreen>
    name: "third"
    #GridLayout:
    #    orientation: "vertical"
#
    #    Button:
    #        font_size: 25
    #        size_hint: 0.3, 0.2
    #        text: "Export Data"
    #        on_press: root.btn3()
#
#
    #    FloatLayout:
    #        cols: 3
    #        Button:
    #            size_hint: 0.3, 0.2
    #            text: "<"
    #            on_release:
    #                app.root.current = "second"
    #                root.manager.transition.direction = "right"
    #            pos_hint: {"left": 1, "bottom": 1}
    #        #Button:
#
    #        Button:
    #            size_hint: 0.3, 0.2
    #            text: ">"
    #            on_release:
    #                app.root.current = "main"
    #                root.manager.transition.direction = "left"
    #            pos_hint: {"right":1, "bottom": 1}

    PageLayout:
        BoxLayout:
            orientation: 'vertical'
            cols: 3
            Label:
                text: "Hi"
            Label:
                text: "This application is still in developement"

            Label:
                text: "Bye"

            Button:
                font_size: 25
                #size_hint: 0.3, 0.2
                text: "Export Data"
                on_press: root.btn3()
        Label:
            text: 'This is just a blank page :('


        BoxLayout:
            orientation: 'vertical'
            cols: 3
            Label:
                text: ":)"
            Label:
                text: "Hello"

            Label:
                text: ":("

            Button:
                text: "Home"
                on_release:
                    app.root.current = "main"
                    root.manager.transition.direction = "right"

0 个答案:

没有答案