Kivy apk crashes with SQLite3 on android

时间:2018-12-03 13:04:54

标签: android python sqlite kivy

I have a small Kivy application using sqlite3 It works fine on windows , even on Ubuntu I use Buildozer on VirtualBox to make the apk The problem is that application runs normally until the time of inserting or reading from database. In thois point on androit , application crashes

My code is quite simple :

 conn = sqlite3.connect('mydb')
 first_name = self.first_name_text_input.text
 last_name = self.last_name_text_input.text
 sql = ''' INSERT INTO students(firstname,lastname)
           VALUES(?,?) '''
 cur = con.cursor()
 cur.execute(sql, (first_name, last_name))

in this point application crashes on android. I have the database file in root directory with main.py when Buildozer makes the apk , so I guess database file is on the apk.

Do I have to do something else with the database file? How can I debug this app to see why it crashes? Where can I find the log file?

Thanks a lot

Kostas

1 个答案:

答案 0 :(得分:0)

尝试将手机连接到PC,然后在手机的设置上启用USB调试。在PC上打开终端,然后键入adb logcat *:E。在手机上打开您的kivy应用,并在应用崩溃时尝试在PC上查看错误。