Android Studio | Android Gradle Plugin版本与项目版本不相符。

huangapple go评论74阅读模式
英文:

Android Studio | Android Gradle Plugin version does not correspond with project version

问题

这是我遇到的错误:

> 该项目正在使用不兼容的版本(AGP 7.3.1)的Android Gradle插件。支持的最新版本是AGP 7.2.1。

当我尝试与Gradle文件同步项目时,出现此错误,但我的build.gradle和项目结构都指定了版本7.2.1,如下所示。

build.gradle:

buildscript {
    dependencies {
        classpath("com.android.tools.build:gradle:7.2.1")
    }
}

项目结构:
Android Studio | Android Gradle Plugin版本与项目版本不相符。

Gradle版本:7.6.2
Android Studio版本:Chipmunk 2021.2.1

我尝试过无效缓存、从磁盘重新加载、gradle clean等操作。我一直无法找到关于版本7.3.1的任何提及,只有在Android Studio构建输出中才能找到。

可能是什么原因导致这个问题?

英文:

This is the error I'm getting:

> The project is using an incompatible version (AGP 7.3.1) of the Android Gradle plugin. Latest supported version is AGP 7.2.1

This error occurs when I attempt to sync the project with gradle files, but my build.gradle and project structure both specify version 7.2.1 as seen below.

build.gradle:

buildscript {
    dependencies {
        classpath("com.android.tools.build:gradle:7.2.1")
    }
}

Project structure:
Android Studio | Android Gradle Plugin版本与项目版本不相符。

Gradle: 7.6.2
Android Studio: Chipmunk 2021.2.1

I have tried invalidating caches, reloading from disk, gradle clean etc. I have been unable to find any mention of version 7.3.1 anywhere, only within android studio build outputs.

What could possibly be causing this?

答案1

得分: 0

更新您的Android Studio,然后您将能够选择AGP 7.3.1及更高版本。您的Android Studio版本有点旧。

  1. 帮助->检查更新... 并更新
  2. (以防万一): 文件->使缓存无效...->(选择全部)使缓存无效并重新启动
  3. 选择您所需的Gradle版本和Android Gradle插件(AGP)版本
  4. 清理并构建您的项目

希望有所帮助!

英文:

Update your Android Studio and you will be able to select AGP 7.3.1 and newer versions. Your Android Studio version is a bit old.

  1. Help->Check for updates... and update
  2. (Just in case): File->Invalidate Caches...->(select all)Invalidate and Restart
  3. Select your dessired gradle version and android graadle pluggin (AGP) version
  4. Clean and build your proyect

Hope it helps!

huangapple
  • 本文由 发表于 2023年7月31日 22:07:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76804427.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定