安装 java 8 后出现的问题
2022-09-04 06:49:45
Android Studio有一个弹出窗口,告诉我在我运行SDK管理器并再次启动Android Studio后,更新可用,我得到了另一个弹出窗口,让我进入Androids网站,它告诉我应该升级到Java JDK 8和JRE 8,当我尝试运行调试时,我遇到了超过235个错误。我卸载了版本8并重新安装了7u80 JDK和JRE,现在我减少了34个错误。当我键入java -version时,我得到1.8.073,这里有所有35个错误。
Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
Error: at java.lang.ClassLoader.defineClass1(Native Method)
Error: at java.lang.ClassLoader.defineClass1(Native Method)
Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
Error: at java.security.AccessController.doPrivileged(Native Method)
Error: at java.security.AccessController.doPrivileged(Native Method)
Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Error:Exception in thread "main"
Error:Exception in thread "main"
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_80\bin\java.exe'' finished with non-zero exit value 1
这是Gradel.build
android {
compileSdkVersion 23
buildToolsVersion '24.0.0 rc1'
defaultConfig {
applicationId "com.kim.printer"
minSdkVersion 21
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
}
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.code.gson:gson:2.4'
compile "com.android.support:support-v4:23.1.0"
compile "com.android.support:support-v13:23.1.0"
compile "com.android.support:cardview-v7:23.1.0"
compile 'com.android.support:appcompat-v7:23.0.0'
compile files('libs/StarIOPort3.1.jar')
compile files('libs/StarIO_Extension.jar')
}
感谢您的任何帮助,我已经为此工作了6个小时,我可以让它编译。