No matching variant of com.android.tools.build:gradle:7.4.2 was found.

一、報錯信息

創建個新項目,運行直接報錯,信息如下:

No matching variant of com.android.tools.build:gradle:7.4.2 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:

A problem occurred configuring root project 'starnote'.
> Could not resolve all files for configuration ':classpath'.> Could not resolve com.android.tools.build:gradle:7.4.2.Required by:project : > com.android.application:com.android.application.gradle.plugin:7.4.2project : > com.android.library:com.android.library.gradle.plugin:7.4.2> No matching variant of com.android.tools.build:gradle:7.4.2 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:- Variant 'apiElements' capability com.android.tools.build:gradle:7.4.2 declares a library, packaged as a jar, and its dependencies declared externally:- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8- Other compatible attribute:- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')- Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:- Incompatible because this component declares documentation and the consumer needed a library- Other compatible attributes:- Doesn't say anything about its target Java version (required compatibility with Java 8)- Doesn't say anything about its elements (required them packaged as a jar)- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')- Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8- Other compatible attribute:- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')- Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:- Incompatible because this component declares documentation and the consumer needed a library- Other compatible attributes:- Doesn't say anything about its target Java version (required compatibility with Java 8)- Doesn't say anything about its elements (required them packaged as a jar)- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

二、錯誤分析

?有些問題是項目中的Gradle版本不是7.4.2,我們需要將build.gradle文件中改它為7.4.2。

plugins {id 'com.android.application' version '7.4.2' apply falseid 'com.android.library' version '7.4.2' apply falseid 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}

這里明顯不是,從報錯信息中我們可以看到是Java 版本沒跟上,需要將Java 8 改為 Java11。

解決方案:

OK->OK->Try Again 齊活。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/161594.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/161594.shtml
英文地址,請注明出處:http://en.pswp.cn/news/161594.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

shell 條件語句

目錄 測試 test測試文件的表達式 是否成立 格式 選項 比較整數數值 格式 選項 字符串比較 常用的測試操作符 格式 邏輯測試 格式 且 (全真才為真) 或 (一真即為真) 常見條件 雙中括號 [[ expression ]] 用法 &…

springboot啟動過程

1、SpringApplication new一個對象會優先調用initialize方法 public SpringApplication(Object... sources) {initialize(sources); } private void initialize(Object[] sources) {//添加配置類SpringBootApplicationif (sources ! null && sources.length > 0) …

關于一些bug的解決1、el-input的輸入無效2、搜索之后發現數據不對3、el多選框、單選框點擊無用4、

el-input輸入無效 原來的代碼是 var test null 但是我發現不能輸入任何值 反倒修改test的初始值為123是可以的 于是我確定綁定沒問題 就是修改的問題 于是改成 var test ref() v-model綁定的值改成test.value就可以了 因為ref是相應式的 可以通過輸入…

【算法】奇偶游戲(帶權并查集)

題目 小 A 和小 B 在玩一個游戲。 首先,小 A 寫了一個由 0 和 1 組成的序列 S,長度為 N。 然后,小 B 向小 A 提出了 M 個問題。 在每個問題中,小 B 指定兩個數 l 和 r,小 A 回答 S[l~r] 中有奇數個 1 還是偶數個 …

cocos2dx ??Animate3D(三)

一些總結 動作(Actions) move移動:moveto/moveby 從一個位置移動到另外一個位置 從一個位置移動多少數量級rotate旋轉:rotateto/rotateby 從一個角度旋轉到另外一個角度 旋轉多少個數量級scale縮放:scaleto/scaleby …

vue實現瀏覽器禁止鼠標選中文字禁止右鍵禁止F12鍵

1. 禁止鼠標選中文字 document.onselectstart new Function("event.returnValuefalse");2.禁止右鍵 document.oncontextmenu new Function("event.returnValuefalse");3. 禁止F12鍵 document.addEventListener("keydown", function (e) {if…

Go語言多線程爬蟲萬能模板它來了!

對于長期從事爬蟲行業的技術員來說,通過技術手段實現抓取海量數據并且做到可視化處理,我在想如果能寫一個萬能的爬蟲模板,后期遇到類似的工作只要套用模板就能解決大部分的問題,如此提高工作效率何樂而不為? 以下是一個…

有關Vue、微信小程序、UniApp中的CSS中的寬度width單位、自適應

在Vue中,可以使用以下單位來設置寬度(width) 像素(px):最常用的單位,表示一個絕對長度單位。例如,width: 200px; 表示寬度為200像素。百分比(%):…

Mac自帶的看圖如何連續查看多張圖片

一、問題 mac看訪達里的圖片時,雙擊打開一張圖片,然后按上下左右鍵都沒法切換到另外的圖片。而且也沒找到像window一樣單擊縮略圖可以看到預覽圖。其實是自己不懂得怎么使用,哈哈哈😂 二、方法 2.1、圖標方式 可以看到縮略圖&a…

新的centos7.9安裝jenkins(二)

更多ruoyi-nbcio功能請看演示系統 gitee源代碼地址 前后端代碼: https://gitee.com/nbacheng/ruoyi-nbcio 演示地址:RuoYi-Nbcio后臺管理系統 接上一節文章。 這個版本默認git也安裝好了,所以全局配置這個不需要了。 maven安裝3.9.3版本…

前綴和——DP35 【模板】二維前綴和

文章目錄 🍎1. 題目🍒2. 算法原理🍅3. 代碼實現 🍎1. 題目 題目鏈接:【模板】二維前綴和_牛客題霸_牛客網 (nowcoder.com) 描述 給你一個 n 行 m 列的矩陣 A ,下標從1開始。 接下來有 q 次查詢&#xff0…

ElasticSearch的日志配置

ElasticSearch默認情況下使用Log4j2來記錄日志,日志配置文件的路徑為$ES_HOME/config/log4j2.properties,配置方法見Log4j2的官方文檔。 參考path-settings,通過指定path.logs,可以指定日志文件的保存路徑。 在日志配置文件$ES_…

【OpenCV實現圖像:使用OpenCV生成拼圖效果】

文章目錄 概要通用配置不考慮間隔代碼實現考慮間隔代碼實現小結 概要 概要: 拼圖效果是一種將圖像切割為相鄰正方形并重新排列的藝術效果。在生成拼圖效果時,可以考慮不同的模式,包括是否考慮間隔和如何處理不能整除的部分。 不考慮間隔&a…

【NLP】GPT 模型如何工作

介紹 2021 年,我使用 GPT 模型編寫了最初的幾行代碼,那時我意識到文本生成已經達到了拐點。我要求 GPT-3 總結一份很長的文檔,并嘗試了幾次提示。我可以看到結果比以前的模型先進得多,這讓我對這項技術感到興奮,并渴望…

HQL刷題 50道

HQL刷題 50道 尚硅谷HQL刷題網站 答案 1.查詢累積銷量排名第二的商品 select sku_id from (select sku_id, dense_rank() over (order by total desc) rnfrom (select sku_id, sum(sku_num) totalfrom order_detailgroup by sku_id) t1) t2 where rn 2;2.查詢至少連續三天下…

php 時區查看和設置

php的時區&#xff0c;關系到相關時間函數的結果 其他相關&#xff1a; linux時區設置&#xff1a;鏈接 pgsql時區設置&#xff1a; 一、查看可以用的時區列表 新建一個php文件&#xff0c;輸入下面程序即可 <?php echo "<pre>"; var_dump(timezone_id…

基于go-zero的rpc服務示例

以下是一個基于 go-zero 框架的簡單 RPC 服務示例&#xff0c;該示例包括一個服務端和一個客戶端通過 gRPC 進行通信。 服務端 1、定義 .proto 文件 在 rpc/add 目錄下創建 adder.proto 文件&#xff0c;定義 RPC 服務&#xff1a; syntax "proto3";package add…

IOS+Appium+Python自動化全實戰教程

由于公司的產品坐落于不同的平臺&#xff0c;如ios、mac、Android、windows、web。因此每次有新需求的時候&#xff0c;開發結束后&#xff0c;留給測試的時間也不多。此外&#xff0c;一些新的功能實現&#xff0c;偶爾會影響其他的模塊功能正常的使用。 網上的ios自動化方面的…

MyBatis-Plus的分頁插件和樂觀鎖插件

MyBatis-Plus: 探索分頁查詢和樂觀鎖插件 在現代的Web應用開發中&#xff0c;高效的數據處理是不可或缺的一部分。MyBatis-Plus&#xff0c;作為MyBatis的增強版&#xff0c;提供了多種插件來簡化和優化數據庫操作。在這篇博客中&#xff0c;我們將重點介紹兩個非常實用的插件…

09_面向對象高級_泛型

泛型 1. 認識泛型 定義類、接口、方法時&#xff0c;同時聲明了一個或多個類型變量&#xff08;如&#xff1a;&#xff09;&#xff0c;稱為泛型類、泛型接口、泛型方法、它們統稱為泛型。 2. 泛型類 public class Test {public static void main(String[] args) {MyArray…