java Complie 版本高于 Build 工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47000908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 09:27:59  来源:igfitidea点击:

Complie version higher than Build tool

javaandroidandroid-studio-3.0build-tools

提问by Priya

Google have recently released API 27. I am planning to update my application with API 27. I have marked that there latest build tool is 26.0.2 and API is 27. If I use like below it can cause any issue in app ?

Google 最近发布了 API 27。我打算用 API 27 更新我的应用程序。我已经标记了最新的构建工具是 26.0.2,API 是 27。如果我像下面这样使用它会导致应用程序出现任何问题?

compileSdkVersion 27
buildToolsVersion "26.0.2"

and Application's minimum and maximum API is like below

和应用程序的最小和最大 API 如下所示

minSdkVersion 16
targetSdkVersion 27

Thanks

谢谢

采纳答案by IntelliJ Amiya

You can use

您可以使用

android {
  compileSdkVersion 27
  buildToolsVersion '27.0.0'

  defaultConfig {
    targetSdkVersion 27
  }

Read official guideline about Set Up the Android 8.1 SDK

阅读官方指南 Set Up the Android 8.1 SDK

回答by Eugen Pechanec

1) Build tools version has nothing to do with compile SDK version.

1)构建工具版本与编译SDK版本无关。

Your current setup will work fine.

您当前的设置将正常工作。

compileSdkVersion 27
buildToolsVersion "26.0.2"

2) You should use the newest build tools available.

2) 您应该使用可用的最新构建工具。

If you had an old project you could say this:

如果你有一个旧项目,你可以这样说:

compileSdkVersion 25
buildToolsVersion "27.0.0"

3) Build tools version is picked automatically in Android plugin 3.0.0.

3) 构建工具版本在 Android 插件 3.0.0 中自动选择。

You don't have to specify it. This is enough:

您不必指定它。这就够了:

compileSdkVersion 27

回答by IntelliJ Amiya

If you are using last version of android-studio you can remove buildToolsVersion "26.0.2"from your gradleit's not mandatory.

如果您使用的是最新版本的 android-studio,您可以buildToolsVersion "26.0.2"从您的gradle 中删除它不是强制性的。

The buildToolsVersionwill work along-side with compileSdkVersion.

buildToolsVersion会工作沿侧compileSdkVersion

回答by letanthang

compileSdkVersion 27
buildToolsVersion "26.0.2"

Your config works. You should use lasted build tool. From android studio 3.0, buildToolsVersion is ignored. It automatically pick the build tool version for you.

您的配置有效。您应该使用持续构建工具。从 android studio 3.0 开始,将忽略 buildToolsVersion。它会自动为您选择构建工具版本。