【发布时间】:2017-02-24 01:02:36
【问题描述】:
我已经搜索了其他问题,但这些答案对我毫无帮助。我在 W10 笔记本电脑上安装了 Android Studio,但总是收到此错误:
错误:Buildtools 24.0.2 需要 Java 1.8 或更高版本。当前的 JDK 版本是 1.7。
我尝试修改 gradle.build 文件(在“compileOptions”中添加 2 行),如下所示:
应用插件:'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'
}
然后我得到一个新错误,我修复了添加“jackOptions”行。但我仍然得到第一个错误错误。我能做什么?
【问题讨论】:
-
在项目结构中检查你的环境变量路径和你的jdk路径,确保应该是1.8
标签: java android android-studio build.gradle