Unity打包APK報錯 using a newer Android Gradle plugin to use compileSdk = 35

Unity打包APK報錯 using a newer Android Gradle plugin to use compileSdk = 35

在這里插入圖片描述
三個報錯信息如下
第一個

WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 35This Android Gradle plugin (7.1.2) was tested up to compileSdk = 32This warning can be suppressed by addingandroid.suppressUnsupportedCompileSdk=35
to this project's gradle.propertiesThe build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 35

第二個

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
ERROR:D:\A_Unity\2022.3.26f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-35\android.jar: D8: java.lang.NullPointerExceptionFAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':launcher:desugarReleaseFileDependencies'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexFileDependenciesTask$DexFileDependenciesWorkerAction> Error while dexing.* 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.orgBUILD FAILED in 1s

第三個

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
ERROR:D:\A_Unity\2022.3.26f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-35\android.jar: D8: java.lang.NullPointerExceptionFAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':launcher:desugarReleaseFileDependencies'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexFileDependenciesTask$DexFileDependenciesWorkerAction> Error while dexing.* 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.orgBUILD FAILED in 1s
]
stdout[
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 35This Android Gradle plugin (7.1.2) was tested up to compileSdk = 32This warning can be suppressed by addingandroid.suppressUnsupportedCompileSdk=35
to this project's gradle.properties

錯誤原因:這個問題報錯的原因是,我使用的 Unity2022.3.26,與之對應的 Android Gradle plugin 也就是 Gradle 版本是 7.1.2,這是Unity 官方給的對應關系
打包 APK 時配置Player Settings-> Android -> OthersSettings -> Identification -> Target API Level -> API Level 35

經測試 API Level 設置為 34/33/32 等低版本都是可以正常打包的

解決方案一
Unity 官方回答:這個問題影響Unity版本2021.3和2022.3 LTS。
目前,由于谷歌構建工具中AAPT2和SDK 35之間的兼容性錯誤,無法在Unity 2021.3和2022.3上構建SDK 35。我們已經向b谷歌報告了這個問題
我們正在Unity內提供修復,但與此同時,請遵循以下解決方案:
在 Unity 項目內 打開 gradleTemplate.properties ,這個文件 生成方式 Player Settings → Publish Settings → Check “Custom Gradle Properties Template” 在 Plugins/Android 文件夾下生成 gradleTemplate.properties 用文本編輯器打開,然后在最后添加一行 android.aapt2FromMavenOverride=<PATH_TO_YOUR_SDK>/build-tools/35.0.0/aapt2.exe
完整路徑以Unity2022.3.26f1 為例安裝路徑 android.aapt2FromMavenOverride=2022.3.26f1/Editor\Data/PlaybackEngines/AndroidPlayer/SDK/build-tools/35.0.0/aapt2.exe
但是這個解決方案,我自己測試是無效的

解決方案二
錯誤原因中已經說了 API Level 設置低于 35 的都是可以正常打包的,那么如果不是必須要求設置 為 35 那么就降低版本,再打包

解決方案三
升級 Unity 版本,經過測試 Unity6 打包 APK 設置 API Level 35 打包正常

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

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

相關文章

HTML5特殊字符

HTML中常用的特殊符號一般都以“&”開頭&#xff0c;以“;”結束。

本地大模型編程實戰(23)用智能體(Agent)實現基于SQL數據構建問答系統(2)

本文將用 智能體(Agent) 實現對 SQLite 數據庫的查詢&#xff1a;用戶用自然語言提出問題&#xff0c;智能體也用自然語言根據數據庫的查詢結果回答問題。 本次將分別在英文、中文環境下&#xff0c;使用 qwen2.5 、 MFDoom/deepseek-r1-tool-calling:7b 以及 llama3.1 做實驗。…

nodejs npm install、npm run dev運行的坎坷之路

1、前面的種種都不說了&#xff0c;好不容易運行起來oap-portal項目&#xff0c;運行idm-ui項目死活運行不起來&#xff0c;各種報錯&#xff0c;各種安裝&#xff0c;各種卸載nodejs&#xff0c;卸載nvm&#xff0c;重裝&#xff0c;都不好使。 2、甚至后來運行npm install會…

gotool在線工具集

1. 包含各種 sql 處理 2. 包含 json 處理 3. 包含 圖片處理 4. 跨平臺傳輸 gotool

猿大師播放器:智慧交通Web網頁低延遲播放監控RTSP H.265視頻解決方案

在智慧城市建設加速推進的今天&#xff0c;智慧交通作為城市"神經系統"正面臨前所未有的發展機遇。據統計&#xff0c;2023年全國交通視頻監控設備保有量已突破4500萬臺&#xff0c;日均產生的視頻數據量超50PB。但在這些龐大數字背后&#xff0c;行業卻普遍面臨著&q…

Web自動化之Selenium控制已經打開的瀏覽器(Chrome,Edge)

在使用selenium進行web自動化或爬蟲的時候,經常會面臨登錄的情況,對于這種情況,我們可以利用Selenium控制已經打開的瀏覽器&#xff0c;從而避免每次都需要重新打開瀏覽器并進行登錄的繁瑣步驟。 目錄 說明 啟動瀏覽器 注意 --user-data-dir說明 代碼設定 代碼 改進代…

【Alertmanager】Alertmanager告警路由,告警靜默,告警抑制,高可用的實現

?? 歡迎大家來到景天科技苑?? ???? 養成好習慣,先贊后看哦~???? ?? 作者簡介:景天科技苑 ??《頭銜》:大廠架構師,華為云開發者社區專家博主,阿里云開發者社區專家博主,CSDN全棧領域優質創作者,掘金優秀博主,51CTO博客專家等。 ??《博客》:Python全…

Vue3 + Vite + TS,使用 配置項目別名屬性:resolve

使用 resolve 配置全局項目路徑別名 1.優化了開發中單頁面引用其他模塊的路徑復雜性 2.妥妥解決了&#xff0c;組件復用當中提高開發效率 // 不使用配置 import { useStore } from ../../../stores // 使用配置 可根據開發者需求任意定義&#xff0c;較多 import { useStore…

Linux主機用戶登陸安全配置

Linux主機用戶登陸安全配置 在Linux主機上進行用戶登錄安全配置是一個重要的安全措施&#xff0c;可以防止未經授權的訪問。以下是如何創建用戶hbu、賦予其sudo權限&#xff0c;以及禁止root用戶SSH登錄&#xff0c;以及通過ssh key管理主機用戶登陸。 創建用戶hbu 使用具有…

基于 SpringBoot Vue 的生鮮商城系統設計和實現(源碼+文檔+部署講解)

技術范圍&#xff1a;SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、Python、爬蟲、數據可視化、小程序、安卓app、大數據、物聯網、機器學習等設計與開發。 主要內容&#xff1a;免費功能設計、開題報告、任務書、中期檢查PPT、系統功能實現、代碼編寫、論文編寫和輔導、論…

設計模式-結構性模式

結構型模式主要關注類或對象的組合&#xff0c;旨在通過識別簡單的結構關系來設計更復雜的結構。以下是幾種常見的結構型設計模式&#xff1a; 1. 適配器模式&#xff08;Adapter Pattern&#xff09; 將一個類的接口轉換成客戶端所期望的另一個接口&#xff0c;使得原本由于接…

VantUI官網更新2025,移動端前端開發

Vant 2 - Mobile UI Components built on Vue https://vant-ui.github.io/vant/v2/#/zh-CN/quickstart Vant 4 - A lightweight, customizable Vue UI library for mobile web apps. https://vant-ui.github.io/vant/#/zh-CN Vant Weapp - 輕量、可靠的小程序 UI 組件庫,微…

《我的AUTOSAR之路》Det 解析

Det 解析 1. 引言和功能概述2. Errors2.1 開發錯誤(Development Errors)2.2 運行時錯誤(Runtime Errors)2.3 臨時故障(Transient Faults)3 錯誤查詢默認錯誤追蹤器(Default Error Tracer,DET) 1. 引言和功能概述 默認錯誤追蹤器(DET):該規范描述了默認錯誤追蹤器(…

電腦連接示波器顯示波形

通過網線連接示波器和電腦&#xff0c;將示波器波形顯示在電腦上直接復制圖片至報告中&#xff0c;以下是配置步驟。 一、設備 網線&#xff0c;Tektronix示波器&#xff0c;電腦 二、使用步驟 1.用網線連接電腦和示波器 2.電腦關掉WiFi&#xff0c;查看IPv4網關地址&#xf…

npm i 失敗權限問題

安裝完node之后, 測試全局安裝一個最常用的 express 模塊進行測試 失敗&#xff0c;但是用管理員權限打開cmd 安裝就成功。 報錯如下&#xff1a; npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and …

上海創智學院(測試)算法筆試(ACM賽制)部分例題

1.第一個題&#xff0c;大概題目意思是求n句話中最長的單詞和最短的單詞 這個題目做的有點磕巴&#xff0c;好幾年沒有寫過c/c了&#xff0c;連string的復制都不會寫了&#xff0c;哈哈哈&#xff0c;太笨了 后面一點點撿起來&#xff0c;還是寫出來了&#xff0c;本身沒啥&…

編寫一個程序,輸出 “Hello, World!“(Python版)

編寫一個程序&#xff0c;輸出 "Hello, World!" 在 Python 中&#xff0c;輸出 “Hello, World!” 的程序非常簡單。你只需要使用 print 函數即可。以下是代碼示例&#xff1a; print("Hello, World!")將這段代碼保存為一個 .py 文件&#xff08;例如 hel…

python實戰項目58:采集蜻蜓FM熱門音頻top排行榜

python實戰項目58:采集蜻蜓FM熱門音頻top排行榜 一、采集流程介紹二、數據接口采集三、使用xpath提取頁面數據1、抓包,找到數據接口2、發送請求,獲取數據3、提取數據4、保存數據一、采集流程介紹 蜻蜓FM熱門音頻top排行榜的鏈接為: https://m.qingting.fm/rank/,首頁如下圖…

【Matlab仿真】Matlab Function中如何使用靜態變量?

背景 根據Simulink的運行機制&#xff0c;每個采樣點會調用一次MATLAB Function的函數&#xff0c;兩次調用之間&#xff0c;同一個變量的前次計算的終值如何傳遞到當前計算周期來&#xff1f;其實可以使用persistent變量實現函數退出和進入時內部變量值的保持。 persistent變…

LaneATT環境配置步驟

本文介紹Ubuntu下配置車道線檢測算法LaneATT代碼運行環境&#xff0c;步驟如下。 1. 從LaneATT官方代碼倉庫下載源碼。也可git直接拉取。 2. 安裝Anaconda或miniconda 。 參考&#xff1a;https://docs.anaconda.com/miniconda/ 3. 創建conda虛擬環境LaneATT&#xff08;環…