如何在Android Studio 3.0.1中更改构建工具版本? [英] How to change build tools version in Android Studio 3.0.1?

查看:163
本文介绍了如何在Android Studio 3.0.1中更改构建工具版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将Android Studio从2.3升级到了3.0.1.但是我收到此错误消息(我已经安装了API 27)并且不知道如何解决它,因为在新版本的android studio中找不到构建工具版本!

I just upgraded my Android studio from 2.3 to 3.0.1. But I get this error message(I have already installed API 27 ) and don't know how to fix it, because I couldn't find the the build tools version in new version of android studio!

Error:Failed to find Build Tools revision 26.0.2 <a href="install.build.tools">Install Build Tools 26.0.2 and sync project</a>

gradle文件已更改,项目结构也只有一个选项卡!

The gradle files are changed, also the project structure has only one tab!

这是app/build.gradle的内容:

this is the content of `app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.m.finalocr"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

如您所见,其中没有 buildToolsVersion .那么,当我在计算机上安装27版本时,为什么我的android studio会查找该版本的特定版本(26)?另外,在哪里可以看到 buildToolsVersion"26.0.2"并将其更改为 buildToolsVersion"27.0.3"`?

As you can see, there is no buildToolsVersion in it. So, why my android studio looks for this specific version(26) of that when I have the 27 version installed on my computer? Also, where can I see the buildToolsVersion "26.0.2" and change it tobuildToolsVersion "27.0.3" ` ?

推荐答案

您的项目正在寻找Build Tools版本26.0.2,但尚未下载并将其安装在计算机上.

Your project is looking for Build Tools version 26.0.2, but you haven't yet downloaded and installed it on your computer.

要下载该文件,请转到工具">"Android">"SDK Manager",然后单击新窗口顶部的"SDK工具"标签.然后,选择右下角的显示软件包详细信息"复选框.最后,向下滚动到您看到26.0.2的位置,选中它旁边的复选框,然后单击确定"开始安装过程.

To download it, go to Tools > Android > SDK Manager, then click on the "SDK Tools" tab at the top of the new window. Then select the "Show Package Details" checkbox in the lower right-hand corner. Finally, scroll down to where you see 26.0.2, check the checkbox next to it, and click "OK" to begin the install process.

如果要更改项目中的构建工具"版本,请在项目的build.gradle文件(在"app"模块中)中指定该版本.打开文件,然后通过在"android"部分添加/更新以下属性来添加或更新要使用的Build Tools版本:

If you want to change the Build Tools version in your project, that is specified in project's build.gradle file (in the 'app' module). Open the file and either add or update the Build Tools version you want to use by adding/updating the following property in the 'android' section:

android {
    buildToolsVersion "27.0.3"
    ...
}

这篇关于如何在Android Studio 3.0.1中更改构建工具版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆