I'm having problems with my MySQL database connection class in Android Studio.
Error:
10-16 15:04:02.872 532-532/com.example.dev.mbstore W/dalvikvm﹕ VFY: unable to find class referenced in signature (Ljavax/naming/Reference;)
10-16 15:04:02.872 532-532/com.example.dev.mbstore I/dalvikvm﹕ Could not find method javax.naming.Reference.get, referenced from method com.mysql.jdbc.ConnectionPropertiesImpl$ConnectionProperty.initializeFrom
10-16 15:04:02.872 532-532/com.example.dev.mbstore W/dalvikvm﹕ VFY: unable to resolve virtual method 8068: Ljavax/naming/Reference;.get (Ljava/lang/String;)Ljavax/naming/RefAddr;
10-16 15:04:02.872 532-532/com.example.dev.mbstore D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0004
10-16 15:04:02.882 532-532/com.example.dev.mbstore W/dalvikvm﹕ VFY: unable to find class referenced in signature (Ljavax/naming/Reference;)
10-16 15:04:02.882 532-532/com.example.dev.mbstore E/dalvikvm﹕ Could not find class 'javax.naming.StringRefAddr', referenced from method com.mysql.jdbc.ConnectionPropertiesImpl$ConnectionProperty.storeTo
10-16 15:04:02.882 532-532/com.example.dev.mbstore W/dalvikvm﹕ VFY: unable to resolve new-instance 518 (Ljavax/naming/StringRefAddr;) in Lcom/mysql/jdbc/ConnectionPropertiesImpl$ConnectionProperty;
10-16 15:04:02.882 532-532/com.example.dev.mbstore D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0006
10-16 15:04:02.882 532-532/com.example.dev.mbstore D/dalvikvm﹕ DexOpt: unable to opt direct call 0x1f86 at 0x14 in Lcom/mysql/jdbc/ConnectionPropertiesImpl$ConnectionProperty;.storeTo
10-16 15:04:03.032 532-540/com.example.dev.mbstore I/dalvikvm﹕ Total arena pages for JIT: 11
10-16 15:04:03.232 532-535/com.example.dev.mbstore D/dalvikvm﹕ GC_CONCURRENT freed 167K, 3% free 10724K/11015K, paused 3ms+3ms
10-16 15:04:03.242 532-532/com.example.dev.mbstore I/dalvikvm﹕ Could not find method java.lang.management.ManagementFactory.getThreadMXBean, referenced from method com.mysql.jdbc.MysqlIO.appendDeadlockStatusInformation
10-16 15:04:03.242 532-532/com.example.dev.mbstore W/dalvikvm﹕ VFY: unable to resolve static method 7453: Ljava/lang/management/ManagementFactory;.getThreadMXBean ()Ljava/lang/management/ThreadMXBean;
10-16 15:04:03.242 532-532/com.example.dev.mbstore D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0079
10-16 15:04:03.351 532-532/com.example.dev.mbstore I/System.out﹕ com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
+++ LOG: entry corrupt or truncated
10-16 15:04:03.351 532-532/com.example.dev.mbstore I/System.out﹕ The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
It seems that it does not find the Driver class but I put the MySQL plugin in the dependencies and had it compiled.
Connection class:
public class DatabaseExport{
private static Connection conn = null;
public static void conectaDB(String url, String porta, String banco, String usuario, String senha)
{
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://"+url+":"+porta+"/"+banco,usuario,senha);
}catch(Exception e)
{
Exceptions.getException(e);
}
}
}