久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

構建 Android 庫時出錯:不支持直接本地 .aar 文件依

Error building Android library: Direct local .aar file dependencies are not supported(構建 Android 庫時出錯:不支持直接本地 .aar 文件依賴項)
本文介紹了構建 Android 庫時出錯:不支持直接本地 .aar 文件依賴項的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我們最近升級到了 Android Gradle 插件 4.0.0-beta03.我們現在在構建我們的庫模塊之一時看到此錯誤

<上一頁>$ ./gradlew library_module: 組裝任務 ':library_module:bundleDebugAar' 執行失敗.> 構建 AAR 時不支持直接本地 .aar 文件依賴項.生成的 AAR 將被破壞,因為來自任何本地 .aar 的類和 Android 資源文件依賴項不會打包在生成的 AAR 中.以前版本的 Android在這種情況下,Gradle 插件也會產生損壞的 AAR(盡管沒有拋出此錯誤).這以下 :library_module 項目的直接本地 .aar 文件依賴項導致此錯誤:______.aar

我可以看到這是幾個月前添加到 AGP.但他們沒有提供有關原因的更多信息.

所以.

  1. 出了什么問題?還有更多信息嗎?我在任何地方都找不到一個錯誤報告.
  2. 我該如何解決這個問題?這是否是說我不能建立一個依賴于其他本地 .aar 的 .aar?如果這個本地 aar 托管在 Maven Central 或其他遠程倉庫上會怎樣?為什么會有不同?

解決方案

我最近遇到了同樣的問題,解決方法是從 libs/ 中刪除庫并使用 File 導入它 ->新 ->新模塊 ->導入.JAR/.AAR Package,然后在庫模塊build.gradle文件中引用:

依賴項{實施項目(:imported_aar_module")}

如果您使用的是較新的 Android Studio 版本 (4.0.0+),則此選項不可用.相反,您必須手動完成.

  1. 新建一個目錄,將以下內容放入新目錄下的build.gradle文件中:

configurations.maybeCreate("default")artifacts.add("default", file('[nameOfTheAar].aar'))

  1. aar 放入這個新目錄中.build.gradle 文件旁邊.
  2. 將新建的 Gradle 項目添加到 settings.gradle 文件中:

include(":pathToTheCreatedDirectory")

  1. 將項目包含在您要使用 aar 的庫中:

實施項目(":pathToTheCreatedDirectory", configuration = "default")

We recently upgraded to Android Gradle Plugin 4.0.0-beta03. We are now seeing this error when building one of our library modules

$ ./gradlew library_module:assemble

Execution failed for task ':library_module:bundleDebugAar'.
> Direct local .aar file dependencies are not supported when building an AAR. 
The resulting AAR would be broken because the classes and Android resources from any local .aar 
file dependencies would not be packaged in the resulting AAR. Previous versions of the Android 
Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The 
following direct local .aar file dependencies of the :library_module project caused this error: 
______.aar

I can see this was added to AGP a few months ago. But they provide no further info on why.

So.

  1. What was the problem? Any more info? I can't find a single bug report anywhere.
  2. How exactly can I fix this? Is this saying that I can't build one .aar that depends on other local .aars? What if this local aar was instead hosted on Maven Central or another remote repo? Why would that make a difference?

解決方案

I recently encountered the same issue, the fix was to remove the library from libs/ and import it using File -> New -> New Module -> Import .JAR/.AAR Package, then referencing it in the library module build.gradle file:

dependencies {
  implementation project(":imported_aar_module")
}

If you are on a newer Android Studio version (4.0.0+), this option is not available. Instead you have to do it manually.

  1. Create a new directory and put the following content into the build.gradle file withing the new directory:

configurations.maybeCreate("default")
artifacts.add("default", file('[nameOfTheAar].aar'))

  1. Place the aar into this new directoy. Next to the build.gradle file.
  2. Add the new created Gradle project to the settings.gradle file:

include(":pathToTheCreatedDirectory")

  1. Include the project in your library where you want to use the aar:

implementation project(":pathToTheCreatedDirectory", configuration = "default")

這篇關于構建 Android 庫時出錯:不支持直接本地 .aar 文件依賴項的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 精品99久久久久久 | 日韩欧美在线不卡 | 国产午夜精品一区二区三区 | 国产精品久久久久久久久久久久冷 | 在线观看中文字幕一区二区 | 亚洲精品国产电影 | 区一区二区三在线观看 | 超碰国产在线 | 久久丁香| 四虎永久免费黄色影片 | 91精品一区| 91高清在线观看 | h视频免费在线观看 | 亚洲欧美精品国产一级在线 | 国产免费自拍 | 久久成人免费 | 91在线一区| 91社影院在线观看 | 天堂在线www | 一区二区三区国产精品 | 久久久久久免费精品一区二区三区 | 日本在线免费 | 一区二区三区四区av | xxx国产精品视频 | 日韩成人 | 成人av一区二区三区 | 黄色欧美视频 | 日韩高清中文字幕 | 精品国产乱码久久久久久丨区2区 | 先锋资源亚洲 | 国产精品亚洲一区 | 在线视频a | 男女羞羞免费网站 | 精品人伦一区二区三区蜜桃网站 | 羞羞视频一区二区 | 国产精品久久久久久久岛一牛影视 | 午夜激情国产 | 亚洲欧洲一区二区 | 91精品国产高清一区二区三区 | 一区二区三区精品视频 | 国产午夜高清 |