添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
犯傻的铅笔  ·  在Eclipse ...·  昨天    · 
逃跑的生菜  ·  android编译失败 ...·  6 天前    · 
神勇威武的炒饭  ·  Central Repository: ...·  1 周前    · 
才高八斗的咖啡  ·  I m trying to define ...·  1 周前    · 
大力的松鼠  ·  The-pit-of-the-Android ...·  1 周前    · 
爱玩的牙膏  ·  20. Gene regulatory ...·  2 月前    · 
越狱的扁豆  ·  6.5.2. Windows 内核 — ...·  3 月前    · 
威武的帽子  ·  SQL ...·  3 月前    · 
重情义的数据线  ·  今日原阳·  4 月前    · 

Android – Gradle could not find method buildToolsVersion() for arguments [23.0.2], but the Build Tools versions actually exists

android android-gradle-plugin gradle

I'm getting a strange error when I try to build my Android app using gradle.

I get this error when I try to run gradle build :

Could not find method buildToolsVersion() for arguments [23.0.2] on root project 'latest'.

However, I checked my android SDK folder to see if this version was actually missing or not. In other words, the results of issuing ls $ANDROID_HOME/build-tools/ is this:

19.1.0  20.0.0  21.1.2  22.0.1  23.0.1  23.0.2  23.0.3

As you can see, the 23.0.2 exists. What seems to be the problem?

This is my root build.gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
allprojects {
    repositories {
        jcenter()
        mavenCentral()
ext {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
subprojects { subproject ->
    afterEvaluate{
        if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

And this is the build.gradle file

apply plugin: 'com.android.application'
apply from: 'copyLibs.gradle'
apply plugin: 'eclipse'
android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    defaultConfig {
        applicationId "com.marco.myapp"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 35
        versionName "1.2.0.15"
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    // avoid Travis failures
    lintOptions {
        abortOnError false
dependencies {
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:recyclerview-v7:22.0.0'
    //compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libraries:openpgp-api-lib')
    compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
    compile 'com.jcraft:jsch:0.1.52'
    compile 'org.apache.commons:commons-io:1.3.2'
    compile 'com.jayway.android.robotium:robotium-solo:5.3.1'
    compile 'com.melnykov:floatingactionbutton:1.2.0'
tasks.findAll {    
    it.name.startsWith 'assemble'
}.each {
    it.dependsOn copyDependenciesIntoLibs

The reason you're seeing this is because the variables you're declaring in the root project are lacking an assignment.

ext {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

Should be:

ext {
    compileSdkVersion = 23
    buildToolsVersion = '23.0.2'