I have managed to pinpoint two of the mistakes I had and will therefore update my question.
Firstly, my previous error:
java.lang.ClassCastException: Bootstrap method returned null
was fixed by simply adding this line to build.graddle (app) dependencies:
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.6.0'
So that was nice, However this did not solve all my issues. This is my current register button method:
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
conn = Utils.getConnection();
} catch (Exception e) {
e.printStackTrace();
}
}
});
As you can see I am focusing solely on getting a connection as it seems to be the heart of the problem. In debugging I also modified getConnection() to the following:
public static Connection getConnection() {
String driver = "com.mysql.cj.jdbc.Driver"; //com.mysql.jdbc.Driver doesn't work either
String url = "url";
String username = "user";
String password = "pass";
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
return null;
}
System.out.println("MySQL JDBC Driver Registered!");
Connection connection = null;
try {
connection = DriverManager.getConnection(url,username, password);
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return null;
}
if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
return connection;
}
And this is the error that I am receiving now:
I/System.out: Connection Failed! Check output console
W/System.err: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
W/System.err: Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Caused by: java.net.SocketException: socket failed: EACCES (Permission denied)
I will keep this up to date on further changes. Again, if the issue is obvious I apologize in advance. Thanks for the help!