本文介绍了安装java 8后出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android Studio有一个弹出窗口告诉我在运行SDK管理器并再次启动Android Studio后可以获得更新我得到另一个popoup,请求我到Androids网站,它告诉我应该升级到Java JDK 8和JRE 8之后我尝试运行调试时遇到了235个错误。我卸载了版本8并重新安装了7u80 JDK和JRE,现在我已经减少了34个错误。当我输入java -version时,我得到1.8.073
这里有35个错误。

Android Studio had a popup telling updates was available after i run the SDK manager and started the Android Studio again I got another popoup that toke me to Androids website where it told me that I should upgrade to Java JDK 8 and JRE 8 after I did i got over 235 errors when try to run the debug. I uninstalled version 8 and reinstalled 7u80 JDK and JRE now I'm down to 34 errors. When I type java -version I get 1.8.073here are all 35 errors.

    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

Here is the 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小时的任何帮助,我可以将其编译。

Thanks for any help I have been working on this for 6 hours and I can get it to compile.

推荐答案

问题出现在buildToolsVersion '24 .0.0 rc1'后将其更改为'23 .0.2'我不再收到错误。

The problem is in the buildToolsVersion '24.0.0 rc1' after changing it to '23.0.2' I no longer get errors.

这篇关于安装java 8后出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 05:10