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

Gradle 8.12中com.android.application插件找不到问题求助

Android Gradle插件无法找到的问题解决

问题概述

执行gradlew build命令编译Android项目时,始终报错无法找到版本为8.2.0的com.android.application插件,已尝试参考Gradle兼容性矩阵更新插件但未解决,目标是完成编译并生成可用APK。

错误日志

初始配置错误日志

The supplied phased action failed with an exception.
A problem occurred configuring project ':app'.
Build file 'C:\Users\Sage\AI\app\build.gradle.kts' line: 1
Plugin [id: 'com.android.application', version: '8.2.0'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.2.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository
Plugin [id: 'com.android.application', version: '8.2.0'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.2.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository

构建命令执行日志

C:\Users\Sage\AI>gradlew build
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Calculating task graph as no cached configuration is available for tasks: build

[Incubating] Problems report is available at: file:///C:/Users/Sage/AI/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Sage\AI\app\build.gradle.kts' line: 1

* What went wrong:
Plugin [id: 'com.android.application', version: '8.2.0'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.2.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.12/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 6m
Configuration cache entry stored.

C:\Users\Sage\AI>gradlew build --warning-mode all
Calculating task graph as no cached configuration is available for tasks: build

> Configure project :
The org.gradle.api.plugins.Convention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further
information: https://docs.gradle.org/8.12/userguide/upgrading_version_8.html#deprecated_access_to_conventions

[Incubating] Problems report is available at: file:///C:/Users/Sage/AI/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Sage\AI\app\build.gradle.kts' line: 1

* What went wrong:
Plugin [id: 'com.android.application', version: '8.2.0'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.2.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.ut.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 26s
Configuration cache entry stored.

解决步骤

  • 检查仓库配置:打开项目根目录的settings.gradle.kts,确保已添加Google Maven仓库,配置示例如下:
    pluginManagement {
        repositories {
            google()
            mavenCentral()
            gradlePluginPortal()
        }
    }
    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
        }
    }
    
  • 确认版本兼容性:Android Gradle Plugin 8.2.0要求Gradle版本至少为8.0,可在gradle/wrapper/gradle-wrapper.properties文件中修改distributionUrl,例如:
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
    
  • 刷新依赖缓存:执行命令gradlew clean build --refresh-dependencies,强制Gradle清理旧缓存并重新拉取插件
  • 排查网络问题:确保网络能正常访问Google Maven仓库,若使用代理,需在gradle.properties中配置代理信息

内容的提问来源于stack exchange,提问作者True Sage

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 03:15:04