简体   繁体   English

如何在Android Studio中的build.gradle中填充值?

[英]How to fill the value in build.gradle in Android studio?

There are lines in build.gradle file build.gradle文件中有几行

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.21'
    }

However, when building the project, the error notes say, "Error:Could not find com.android.tools.build:gradle:1.21." 但是,在构建项目时,错误注释会显示“错误:找不到com.android.tools.build:gradle:1.21”。

So how to find the gradle number that installed in my Android Studio? 那么如何找到我的Android Studio中安装的gradle编号呢?

Source code is from the official training: Developer site 源代码来自官方培训: 开发人员站点

Your gradle plugin version is incorrect. 您的gradle插件版本不正确。 Try this: 尝试这个:

dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
    }

Try to add (+) sign for the latest version: 尝试添加(+)符号以获取最新版本:

buildscript {
repositories {
    mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:0.12.+'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM