0

I already searched other questions, but those answers didn't help me at all. I installed Android Studio in a W10 laptop, but I always get this error:

Error:Buildtools 24.0.2 requires Java 1.8 or above. Current JDK version is 1.7.

The problem is that I already have that sdk installed as you can see here.

I tried to modify the gradle.build file (adding the 2 lines inside "compileOptions") like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.example.jck.prova"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        jackOptions {
            enabled true
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.1'
}

Then I got a new error, that I fixed adding the "jackOptions" lines. But I still get the first error error. What can i do?

As As
  • 2,049
  • 4
  • 17
  • 33

1 Answers1

1

Go to File -> Project Structure, then SDK Location and set the correct path to de JDK.

Federico Blumetto
  • 967
  • 1
  • 7
  • 12