升级Android Studio Iguana后Gradle同步失败:AGP 8.3.1插件缺失
升级Android Studio Iguana后Gradle同步失败问题
报错信息
Plugin [id: 'com.android.application', version: '8.3.1', apply: false] was not found in any of the following sources: * Try: > 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. * Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.android.application', version: '8.3.1', apply: false] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.3.1') Searched in the following repositories: Google MavenRepo Gradle Central Plugin Repository
项目构建文件
build.gradle.kts(项目级)
// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { id("com.android.application") version "8.3.0" apply false id("com.android.library") version "8.3.0" apply false id("org.jetbrains.kotlin.android") version "1.8.10" apply false }
build.gradle.kts(:app模块)
plugins { id("com.android.application") id("org.jetbrains.kotlin.android") id("kotlin-android") } android { namespace = "com.example.myapp" compileSdk = 34 defaultConfig { applicationId = "com.example.myapp" minSdk = 24 targetSdk = 33 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true } signingConfigs { create("release") { storeFile = file("/raw/keystore.jks") storePassword = "password" keyAlias = "key0" keyPassword = "password" } } buildTypes { getByName("release") { signingConfig = signingConfigs.getByName("release") } } } buildTypes { release { isDebuggable = true isMinifyEnabled = true isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) } } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = "1.8" } buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = "1.4.3" } packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" } } }
settings.gradle.kts
pluginManagement { repositories { google() mavenCentral() gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() } } rootProject.name = "My App" include(":app")
项目结构简单,文件夹结构可参考:
已尝试的解决方案
- 未使用代理
- 未开启离线模式
- 可正常下载其他版本的Gradle
- 当前API为34,Java版本17,AGP版本8.4
- 尝试过Gradle版本8.1至8.7,Gradle JDK为17
- 尝试使用Gradle Wrapper和本地版本,更换过所有Gradle JDK变体
- 调整过插件仓库的顺序
- 尝试过清理缓存、删除~/.gradle及项目中的.gradle文件夹
- 重装Android Studio、重启Windows系统及电脑
- 重置默认设置
- 新建空白Android项目仍出现相同错误
请问还有哪些遗漏的排查点或解决方案?
内容的提问来源于stack exchange,提问作者Aleatoric
相关产品推荐
相关产品推荐

