One problem I have not understood all along: what I am using now is
JDKBut I am writing
AndroidCode cannot be used
JAVA 8New features of (e.g.
lambdaExpression). Why is this?
AndroidOnly support to
java 6In other words, the application will not be compiled using what I specified
JDKVersion, but compiled into
JDK 6The code of. Is that so? If so, then
Android StudioThere must be some
JAVAProgram, then why specify
There are written program calls
JAVA APIIs it the same version on every mobile phone, do I use it
java7The method, but running on the machine
jreThe environment is
java6, and then cannot find the method exception?
In general, it is in the process of writing
AndroidWhen applied, yes
JDKThere is some confusion in the version of the problem, please find the solution.
First of all, the early Android version is Java 6, and Java 7 can be used after Android version 4.4. In addition, earlier versions can be compiled with Java 7 as long as you don’t use it.
try resourceThis new feature will suffice.
Then answer your question again, why can’t Android be compiled through Java 8? This is not to say that Android cannot be compiled by Java 8, but because the Android system running on every human machine is based on Java 6 or Java 7.
DalvikEven if you compile Android programs with new features through Java 8, it cannot run on these machines. In addition, Android is not compiled purely in Java, and class files need to be converted into dex files after compilation, which is closely connected with the Android SDK. therefore, the Android SDK does not support Java 8 and cannot be upgraded by modifying JDK.