一、報錯信息
在 Mac 中創(chuàng)建的 Android Studio 工程 , 將該項目遷移到 Windows 中后 , 報如下錯誤 :
The project is using an incompatible version (AGP 7.4.2) of the Android Gradle plugin.
Latest supported version is AGP 7.3.1
See Android Studio & AGP compatibility options.
二、解決方案
翻譯下報錯信息 : 您的項目正在使用一個不兼容的 Android Gradle 插件版本(AGP 7.4.2),最新支持的版本是 AGP 7.3.1。
AGP 是 Android Gradle Plugin 的簡寫 ;
上述報錯的原因是 Android Studio 開發(fā)環(huán)境 與 Android Gradle 插件 版本不兼容導(dǎo)致的 ;
在 Android Gradle 插件和 Android Studio 兼容性 文檔中 , 給出了 Android Studio 與 Android Gradle 插件 的 兼容版本情況 :
Android Studio 版本 | 所需 Android Gradle 插件版本 |
---|---|
Giraffe | 2022.3.1 | 3.2-8.1 |
Flamingo | 2022.2.1 | 3.2-8.0 |
Electric Eel | 2022.1.1 | 3.2-7.4 |
Dolphin | 2021.3.1 | 3.2-7.3 |
Chipmunk | 2021.2.1 | 3.2-7.2 |
Bumblebee | 2021.1.1 | 3.2-7.1 |
Arctic Fox | 2020.3.1 | 3.1-7.0 |
選擇 " 菜單欄 / Help / About " 選項 ,
可以查看當(dāng)前的 Android Studio 版本號 ;
Android Studio Dolphin | 2021.3.1 Patch 1
Build #AI-213.7172.25.2113.9123335, built on September 30, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
ide.images.show.chessboard=true
Non-Bundled Plugins:
com.duke.screenmatch (3.1)
Dart (213.7433)
io.flutter (71.2.3)
當(dāng)前 Android Studio 的版本號是 " Android Studio Dolphin | 2021.3.1 Patch 1 " , 與之匹配的 Android Gradle 插件版本是 " 3.2-7.3 " ;
使用該 " Android Studio Dolphin " 版本的 Android Studio , 最高只能配置的 Android Gradle 插件的版本為 7.3.1 ;
在 Mac 中創(chuàng)建的項目 , 自動生成的 Android Gradle 插件 版本是 7.4.2 , 說明 Mac 中項目版本號是 " Electric Eel | 2022.1.1 " 或者更高的版本 ;
將 build.gradle 構(gòu)建腳本中的 com.android.application
插件 和 com.android.library
插件的版本修改為 7.3.1 , 即可完成編譯 ;文章來源:http://www.zghlxwxcb.cn/news/detail-442620.html
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}
文章來源地址http://www.zghlxwxcb.cn/news/detail-442620.html
到了這里,關(guān)于【錯誤記錄】Android Studio 編譯報錯 ( The project is using an incompatible version (AGP 7.4.2) of the Androi )的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!