0

I am new to learning Android. I am stuck in first step. I am getting error

Error:Buildtools 24.0.2 requires Java 1.8 or above.

Current JDK version is 1.7. My question is: Can I run the program with the java version 7? If so then how can I do this. I have Java version 7 installed on my PC. I am using ice-cream sandwich while creating project. My build.gradle file has following configuration:

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        applicationId "com.example.dhaval.myapplication"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    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'
}
Sebastian S
  • 4,420
  • 4
  • 34
  • 63
APPY SHAH
  • 7
  • 1
  • 6

2 Answers2

0

put this to your build gradle.

compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
}
0

My suggestion is updating your JDK version...

Java 8

then check your java version,at last you should set the AS jdk location path if the version code is "1.8.0_101".

File-->Project Structure-->JDK location(you can choose using embedded JDK if it is JDK1.8) select the right location

Community
  • 1
  • 1
Zhang Xiang
  • 422
  • 4
  • 15