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

Android项目AGP版本不兼容求助:无法适配支持的AGP 8.0.2版本

解决Android Gradle插件(AGP)版本不兼容问题

报错明确指出项目使用的AGP 8.2.0-alpha10为预览版,与当前环境支持的最新稳定版8.0.2不兼容,直接降级AGP版本即可解决,同时需同步调整相关依赖版本:

修改步骤

  • 将buildscript块中的AGP版本替换为8.0.2
  • 将plugins块中所有com.android.application和com.android.library的版本替换为8.0.2
  • 同步org.jetbrains.kotlin.plugin.serialization的版本与Kotlin主版本一致(原Kotlin版本为1.8.0,因此序列化插件版本也改为1.8.0)

修改后的完整根目录build.gradle代码

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.0.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '8.0.2' apply false
    id 'com.android.library' version '8.0.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
    id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.0'
}

tasks.register('clean') {
    delete rootProject.buildDir
}

修改完成后,点击Android Studio右上角的"Sync Now"按钮同步项目,即可解决版本不兼容问题。

内容的提问来源于stack exchange,提问作者Oscar Rangel

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 07:45:05