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

Gradle 7.0搭配Android插件7.0.4遇报错,求助解决插件未找到问题

解决Gradle插件找不到及项目构建失败问题

1. 修正仓库配置

项目根目录的settings.gradle必须配置Google和MavenCentral仓库,否则无法拉取Android插件:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "你的项目名"
include ':app'

2. 严格匹配插件与Gradle版本

Android Studio插件7.0.4的官方对应Gradle版本是7.0.2,不要随意更换7系列其他版本,修改gradle/wrapper/gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

3. 清理缓存并重启同步

  • 执行File → Invalidate Caches...,选择Invalidate and Restart重启Android Studio
  • 删除项目根目录的.gradle、build文件夹,以及app模块下的build文件夹,再重新点击同步按钮

4. 检查插件声明语法

确认项目根目录build.gradle中的插件声明格式正确:

plugins {
    id 'com.android.application' version '7.0.4' apply false
    // 其他插件按需添加
}

内容的提问来源于stack exchange,提问作者Hosna Hatami

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 23:29:54