You need to connect to MySQL in Android Studio and create a table like this: I'm trying to do this:
try{ String url = "jdbc:mysql://localhost/qrdb"; String username = "root"; String password = "****"; Class.forName("com.mysql.cj.jdbc.Driver").getDeclaredConstructor().newInstance(); String sqlCommand = "CREATE TABLE items (Id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(20), price INT)"; try (Connection conn = DriverManager.getConnection(url, username, password)){ Statement statement = conn.createStatement(); statement.executeUpdate(sqlCommand); Log.i("mytag","Database has been created!"); } } catch(Exception ex){ Log.i("mytag","Connection failed..."); Log.i("mytag", "" + ex); } I run on the emulator does not issue exceptions and the application stupidly closes. In a normal java project, everything works. There probably need to replace localhost with something, but I changed it to myip: port - it did not help. MySQL Connector / J 8.0 itself is installed in the project and all classes are visible in a normal project, everything works.