久久久久久久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 庫的傳遞依賴)
主站蜘蛛池模板: 欧美在线一二三 | 欧美一区2区三区4区公司 | 日韩成人在线播放 | 精品国产乱码久久久久久久久 | www.久久 | 毛片免费视频 | 亚洲国产精品网站 | 亚洲高清av | 国产精品一区二区三区在线 | 亚洲欧美国产毛片在线 | 91网站在线看 | 日韩不卡在线 | 午夜爱爱网 | 亚洲精品二区 | 综合色导航 | 天天综合亚洲 | 亚洲一区二区视频 | 在线看无码的免费网站 | 日本久久综合网 | 鸡毛片| 视频一区二区中文字幕 | 国产精品久久久久久久久久妞妞 | 亚洲 欧美 日韩在线 | 日韩影音| 亚洲成人av | 亚洲成人免费在线 | 亚洲色图婷婷 | 成人免费网站视频 | 久久国产精品一区二区三区 | 中文字幕久久久 | 亚洲三区视频 | 国产 欧美 日韩 一区 | 日韩a视频 | 草草视频在线免费观看 | 综合第一页 | 国产精品a久久久久 | 特级丰满少妇一级aaaa爱毛片 | 久久伊| 国产一二区视频 | 亚洲国产成人av | 国产精品久久欧美久久一区 |