[英]Running programs on Android studio with jdk 7
I am new to learning Android. 我刚开始学习Android。 I am stuck in first step.
我陷入了第一步。 I am getting error
我遇到错误
Error:Buildtools 24.0.2 requires Java 1.8 or above.
错误:Buildtools 24.0.2需要Java 1.8或更高版本。
Current JDK version is 1.7. 当前的JDK版本是1.7。 My question is: Can I run the program with the java version 7?
我的问题是:我可以在Java版本7中运行该程序吗? If so then how can I do this.
如果是这样,那我该怎么做。 I have Java version 7 installed on my PC.
我的PC上安装了Java版本7。 I am using ice-cream sandwich while creating project.
我在创建项目时使用冰淇淋三明治。 My build.gradle file has following configuration:
我的build.gradle文件具有以下配置:
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'
}
put this to your build gradle. 将此放入您的构建gradle。
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
My suggestion is updating your JDK version... 我的建议是更新您的JDK版本...
then check your java version,at last you should set the AS jdk location path if the version code is "1.8.0_101". 然后检查您的Java版本,如果版本代码为“ 1.8.0_101”,则最后应设置AS jdk的位置路径。
File-->Project Structure-->JDK location(you can choose using embedded JDK if it is JDK1.8) select the right location 文件->项目结构-> JDK位置(如果是JDK1.8,则可以选择使用嵌入式JDK)选择正确的位置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.