I am trying to sync my project with the Gradle files but every time I do it I get the same error message:
我正在尝试将我的项目与Gradle文件同步,但每次我这样做时都会收到相同的错误消息:
WARNING: The specified Android SDK Build Tools version (27.0.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
警告:指定的Android SDK Build Tools版本(27.0.0)将被忽略,因为它低于Android Gradle Plugin 3.2.1的最低支持版本(28.0.3)。
My target SDK version is API 24 since I am developing an app for an Android 7.0 (Nougat) operating system.
我的目标SDK版本是API 24,因为我正在为Android 7.0(Nougat)操作系统开发应用程序。
I looked over the Android Developers site: https://developer.android.com/
and I can't find anything about what Android Gradle Plugin corresponds with which target SDK version. I've read several Stack Overflow questions where people asked about which specific Android Gradle Plugin they need for their project but none of the questions were about where to go to find that information.
我查看了Android开发者网站:https://developer.android.com/,我找不到任何关于Android Gradle Plugin与哪个目标SDK版本对应的信息。我已经阅读了几个Stack Overflow问题,人们询问他们的项目需要哪些特定的Android Gradle插件,但没有一个问题是关于在哪里找到这些信息。
Can anyone tell me how to know which Android Gradle plugin version I need?
谁能告诉我如何知道我需要哪个Android Gradle插件版本?
Here are the two build.gradle files in my app folder:
以下是我的app文件夹中的两个build.gradle文件:
(Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '27.0.0'
defaultConfig {
applicationId "com.android.example.favoritetoys"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
debuggable true
}
debug {
applicationIdSuffix ".debug"
debuggable true
}
}
}
(Project)
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
}
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
1 个解决方案
#1
2
Since AGP (Android Gradle Plugin) version 3.0.0, there is a minimum version requirement for the Android Build Tools version, which is a designed behaviour.
自从AGP(Android Gradle Plugin)版本3.0.0起,Android Build Tools版本有一个最低版本要求,这是一种设计行为。
So, if you want to force your project to use an older version of build tools, i am afraid that you need to downgrade your AGP to a version below 3.0.0.
因此,如果您想强制您的项目使用旧版本的构建工具,我担心您需要将AGP降级到低于3.0.0的版本。
But, question for you is why do have to use the older build tools?
但是,问题是为什么必须使用旧的构建工具?
As seen from https://developer.android.com/studio/releases/build-tools.
从https://developer.android.com/studio/releases/build-tools可以看出。
You should always keep your Build Tools component updated by downloading the latest version using the Android SDK Manager.
您应该始终使用Android SDK Manager下载最新版本来更新Build Tools组件。
For your cross reference about the differences among the three different version configurations in build.gradle
, i.e. compileSdkVersion
, targetSdkVersion
and minSdkVersion
.
有关build.gradle中三种不同版本配置之间差异的交叉引用,即compileSdkVersion,targetSdkVersion和minSdkVersion。
- What is the difference between compileSdkVersion and targetSdkVersion?
- What is the difference between min SDK version/target SDK version vs. compile SDK version?
compileSdkVersion和targetSdkVersion有什么区别?
min SDK版本/目标SDK版本与编译SDK版本有什么区别?
For your case, maybe you only need to change your targetSdkVersion
to 28.
对于您的情况,也许您只需要将targetSdkVersion更改为28。
#1
2
Since AGP (Android Gradle Plugin) version 3.0.0, there is a minimum version requirement for the Android Build Tools version, which is a designed behaviour.
自从AGP(Android Gradle Plugin)版本3.0.0起,Android Build Tools版本有一个最低版本要求,这是一种设计行为。
So, if you want to force your project to use an older version of build tools, i am afraid that you need to downgrade your AGP to a version below 3.0.0.
因此,如果您想强制您的项目使用旧版本的构建工具,我担心您需要将AGP降级到低于3.0.0的版本。
But, question for you is why do have to use the older build tools?
但是,问题是为什么必须使用旧的构建工具?
As seen from https://developer.android.com/studio/releases/build-tools.
从https://developer.android.com/studio/releases/build-tools可以看出。
You should always keep your Build Tools component updated by downloading the latest version using the Android SDK Manager.
您应该始终使用Android SDK Manager下载最新版本来更新Build Tools组件。
For your cross reference about the differences among the three different version configurations in build.gradle
, i.e. compileSdkVersion
, targetSdkVersion
and minSdkVersion
.
有关build.gradle中三种不同版本配置之间差异的交叉引用,即compileSdkVersion,targetSdkVersion和minSdkVersion。
- What is the difference between compileSdkVersion and targetSdkVersion?
- What is the difference between min SDK version/target SDK version vs. compile SDK version?
compileSdkVersion和targetSdkVersion有什么区别?
min SDK版本/目标SDK版本与编译SDK版本有什么区别?
For your case, maybe you only need to change your targetSdkVersion
to 28.
对于您的情况,也许您只需要将targetSdkVersion更改为28。