I using google GCM github example
I want add a sql connection in this example
so I write this try in eclipse , this is successed
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://ip:port/";
String user = "root";
String password = "123456";
try {
sql setting ...
}
}
catch(ClassNotFoundException e) {
System.out.println("No");
e.printStackTrace();
}
catch(SQLException e) {
e.printStackTrace();
}
but when I created a *.java in GCM example and copy to *.java
and add this code to bulid.gradle(Module.app)
it's failed
sourceCompatibility = 1.7
targetCompatibility = 1.7
this is error message
Error:Gradle: Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
how to fix it?
BTW commend cmd java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)