I installed the latest Android studio and am getting a gradle project sync failed when I start a new project:
build.gradel file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
When i added:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
I got this error:
Add this to your build.gradle.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
inside android { }
Trageting Android 21 requires JavaVersion 1.7. default is 1.6.
In the case you don't have JDK 7 installed download it from jdk download site
Newer version of Android Studio have built-in OpenJDK 8 , So with newer version of Android Studio this error should not exist and You no longer need to download Oracle JDK unless you really want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.