You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android项目报错:Build Tools 23.0.3低于AGP 3.1.2最低要求27.0.3

Fixing the Android SDK Build Tools Version Mismatch Error

Hey there! Let's work through this issue step by step—since you're new to Android development, I'll keep things clear and straightforward. The error you're seeing happens because your Android Gradle Plugin (AGP) version (3.1.2) requires a minimum Build Tools version of 27.0.3, but your project is still set to use 23.0.3. Let's fix this properly:

Step 1: Update the Module-level build.gradle file

This is the critical file inside your app module (usually located at app/build.gradle). You might have edited the wrong file before, so double-check you're modifying this one:

android {
    // Make sure compileSdkVersion is at least 27 to match the required build tools
    compileSdkVersion 27
    // Set this to the minimum required version for AGP 3.1.2
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.your.app.package"
        minSdkVersion ... // Keep your existing minSdkVersion
        targetSdkVersion 27 // Align this with compileSdkVersion for best compatibility
        ...
    }
    ...
}

Tip: Your compileSdkVersion and targetSdkVersion should ideally match the build tools version you're using—this avoids unexpected compatibility gaps.

Step 2: Confirm the Project-level build.gradle file

Check the root project's build.gradle to ensure you're still using AGP 3.1.2 (the version mentioned in your error). The buildscript block should look like this:

buildscript {
    repositories {
        google()
        jcenter() // Older AGP versions may still require this repository
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        ... // Other dependencies go here
    }
}

Step 3: Sync Gradle and Install Missing Tools

After updating the files:

  • Click the Sync Now button that appears at the top right of Android Studio (it pops up automatically when you modify build files).
  • If Android Studio says it can't find Build Tools 27.0.3, it will prompt you to install it. Follow the on-screen instructions to download and install the missing version via the SDK Manager.

Step 4: Clean and Rebuild the Project

Old build artifacts can sometimes cause lingering issues, so let's do a fresh build:

  • Go to Build > Clean Project in the Android Studio menu.
  • Once the clean finishes, go to Build > Rebuild Project.

Why your initial fix might not have worked

  • You might have edited the project-level build.gradle instead of the module-level one (easy mix-up for new devs!).
  • Your compileSdkVersion was set to a version lower than 27, which would still conflict with the required build tools.
  • You forgot to sync Gradle after making the change—this step is essential for Android Studio to apply your updates.

If you still run into trouble after these steps, feel free to share snippets of your build.gradle files (just redact any sensitive info like your app's package name) and I can help troubleshoot further.

内容的提问来源于stack exchange,提问作者Hanan Sabag

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:29:34