久久久久久久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久久久久久人 | 在线免费观看a级片 | 日本三级电影在线免费观看 | 欧美成人猛片aaaaaaa | 少妇久久久| 夜夜爽99久久国产综合精品女不卡 | 日韩精品极品视频在线观看免费 | 成人午夜免费网站 | 日本欧美在线视频 | 午夜电影日韩 | 国产精品久久久久久久午夜片 | 999久久久 | 中文字幕一区二区在线观看 | 午夜手机在线视频 | 亚洲一区二区在线 | 91久久国产综合久久 | 国产1区2区在线观看 | 欧美国产91| 天天干天天草 | 特黄色毛片 | 2018中文字幕第一页 | 欧美日韩久久精品 | 日本亚洲精品成人欧美一区 | 婷婷五月色综合 | 成人一区二区三区在线观看 | 国产999精品久久久久久 | 久久久久久久久久久蜜桃 | 国产精品一区在线观看 | 欧美精品综合 | 在线免费观看黄色 | 亚洲欧美视频一区二区 | 欧美精品一区免费 | 91观看 | 九九久久精品视频 | 国产精品一区二区免费看 | 成人在线播放网站 | 亚洲第一成人影院 | a精品视频| 午夜在线视频 | 精品国产乱码一区二区三 |