'Kivy/MySQL/colab-google Mysql request does not work

I'm using python/Kivy/MySQL/colab-google to compile an apk. When I run the app on Android, I give the command to register the app shuts down.

main.py

  import kivy
  from kivy.app import App
  from kivy.uix.screenmanager import ScreenManager, Screen
  from kivy.lang import Builder
  from kivy.properties import ObjectProperty
  import mysql.connector

  Builder.load_file("main.kv")
 class registerScreen(Screen):
     usernameInput = ObjectProperty(None)
     emailInput = ObjectProperty(None)
     passwordInput = ObjectProperty(None)
def addInfoToDB(self):
    db = mysql.connector.connect(
        db="tornikesch",
        host="localhost",
        user="tttt",
        password="1111")
    values = (self.usernameInput.text, self.emailInput.text, self.passwordInput.text)
    cursor = db.cursor(buffered=True)
    query = "INSERT INTO registeredusers (Username, Email, Password) VALUES (%s, %s, %s)"
    cursor.execute(query, values)
    db.commit()
    print(cursor.rowcount, "record inserted.")
class loginScreen(Screen):
    usernameInputLogin = ObjectProperty(None)
    passwordInputLogin = ObjectProperty(None)
    def checkIfDetailsExist(self):
       db = mysql.connector.connect(
           db="torn",
           host="localhost",
           user="tttt",
           password="1111")
    cursor = db.cursor(buffered=True)
    cursor.execute("SELECT * FROM registeredusers")
    fetchInfo = cursor.fetchone()
    if self.usernameInputLogin.text in fetchInfo and self.passwordInputLogin.text in 
fetchInfo:
        print("success")
    else:
        print("fail")
class MyApp(App):
def build(self):
    sm = ScreenManager()
    sm.add_widget(loginScreen(name='login'))
    sm.add_widget(registerScreen(name='register'))
    return sm
if __name__ == "__main__":
    MyApp().run()

The reason I suggest is a call to mysql. What is the solution when using kivy to call mysql. Please help me..



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source