错误:SDK Build Tools修订版(23.0.3)对于项目':app'来说太低了.最低要求是25.0.0

Shy*_*han 34 android android-studio

标题是重复的,但我的问题是不同的.

同样的项目工作正常,并允许建立

buildToolsVersion 23.0.3

在我的同事的系统上.据我所知,只有android studio版本不同.如果我没有将我的android工作室升级到"2.3.Beta 2",我仍然可以用23.0.3构建吗?

isa*_*ent 97

你必须改变顶层 的build.gradle

// 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.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
//        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)

至:

// 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.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
//        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)


Mud*_*han 5

好的,我找到了解决方案.

对于将来面临同样问题的人来说,这就是我所做的:

我将以下内容添加到我的root build gradle android/build.gradle(不是android/app/build.gradle)

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 25
                buildToolsVersion '25.0.0'
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这会强制所有子模块使用指定的compileSdkVersion和buildToolsVersion.问题现在消失了.