Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problems after installing java 8

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.073 here 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

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')
}

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

like image 386
Kim HJ Avatar asked Mar 10 '16 07:03

Kim HJ


2 Answers

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

like image 146
Kim HJ Avatar answered Sep 23 '22 03:09

Kim HJ


This problem occurs when you update to Android Studio to 2.0.

To solve this problem:

  • Open build.gradle file
  • Change buildToolsVersion "24.0.0 rc1" to buildToolsVersion "23.0.2"

Happy coding.

like image 21
saibaba vali Avatar answered Sep 24 '22 03:09

saibaba vali