pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

構(gòu)建 Android 庫時(shí)出錯(cuò):不支持直接本地 .aar 文件依

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

問題描述

我們最近升級到了 Android Gradle 插件 4.0.0-beta03.我們現(xiàn)在在構(gòu)建我們的庫模塊之一時(shí)看到此錯(cuò)誤

<上一頁>$ ./gradlew library_module: 組裝任務(wù) ':library_module:bundleDebugAar' 執(zhí)行失敗.> 構(gòu)建 AAR 時(shí)不支持直接本地 .aar 文件依賴項(xiàng).生成的 AAR 將被破壞,因?yàn)閬碜匀魏伪镜?.aar 的類和 Android 資源文件依賴項(xiàng)不會(huì)打包在生成的 AAR 中.以前版本的 Android在這種情況下,Gradle 插件也會(huì)產(chǎn)生損壞的 AAR(盡管沒有拋出此錯(cuò)誤).這以下 :library_module 項(xiàng)目的直接本地 .aar 文件依賴項(xiàng)導(dǎo)致此錯(cuò)誤:______.aar

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

所以.

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

解決方案

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

依賴項(xiàng){實(shí)施項(xiàng)目(:imported_aar_module")}

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

  1. 新建一個(gè)目錄,將以下內(nèi)容放入新目錄下的build.gradle文件中:

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

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

include(":pathToTheCreatedDirectory")

  1. 將項(xiàng)目包含在您要使用 aar 的庫中:

實(shí)施項(xiàng)目(":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")

這篇關(guān)于構(gòu)建 Android 庫時(shí)出錯(cuò):不支持直接本地 .aar 文件依賴項(xiàng)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現(xiàn) IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當(dāng)前風(fēng)味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復(fù)“意外元素lt;查詢gt;在“清單中找到錯(cuò)誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風(fēng)味庫的多風(fēng)味應(yīng)用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運(yùn)行時(shí)有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 冷却塔风机厂家_静音冷却塔风机_冷却塔电机维修更换维修-广东特菱节能空调设备有限公司 | 电机铸铝配件_汽车压铸铝合金件_发动机压铸件_青岛颖圣赫机械有限公司 | 成都治疗尖锐湿疣比较好的医院-成都治疗尖锐湿疣那家医院好-成都西南皮肤病医院 | 焊接烟尘净化器__焊烟除尘设备_打磨工作台_喷漆废气治理设备 -催化燃烧设备 _天津路博蓝天环保科技有限公司 | 德州网站制作 - 网站建设设计 - seo排名优化 -「两山建站」 | 集菌仪厂家_全封闭_封闭式_智能智能集菌仪厂家-上海郓曹 | 实战IT培训机构_IT培训班选大学生IT技术培训中心_中公优就业 | 铝扣板-铝方通-铝格栅-铝条扣板-铝单板幕墙-佳得利吊顶天花厂家 elisa试剂盒价格-酶联免疫试剂盒-猪elisa试剂盒-上海恒远生物科技有限公司 | 磁力抛光机_磁力研磨机_磁力去毛刺机-冠古设备厂家|维修|租赁【官网】 | 艺术漆十大品牌_艺术涂料加盟代理_蒙太奇艺术涂料厂家品牌|艺术漆|微水泥|硅藻泥|乳胶漆 | 纸塑分离机-纸塑分离清洗机设备-压力筛-碎浆机厂家金双联环保 | 自动检重秤-动态称重机-重量分选秤-苏州金钻称重设备系统开发有限公司 | 铝箔-铝板-花纹铝板-铝型材-铝棒管-上海百亚金属材料有限公司 | 丝印油墨_水性油墨_环保油墨油漆厂家_37国际化工 | 高压互感器,电流互感器,电压互感器-上海鄂互电气科技有限公司 | 北京包装设计_标志设计公司_包装设计公司-北京思逸品牌设计 | 阿尔法-MDR2000无转子硫化仪-STM566 SATRA拉力试验机-青岛阿尔法仪器有限公司 | 杜甫仪器官网|实验室平行反应器|升降水浴锅|台式低温循环泵 | 化工ERP软件_化工新材料ERP系统_化工新材料MES软件_MES系统-广东顺景软件科技有限公司 | 【365公司转让网】公司求购|转让|资质买卖_股权转让交易平台 | 齿轮减速马达一体式_蜗轮蜗杆减速机配电机-德国BOSERL齿轮减速电动机生产厂家 | 自动化生产线-自动化装配线-直流电机自动化生产线-东莞市慧百自动化有限公司 | 标准光源箱|对色灯箱|色差仪|光泽度仪|涂层测厚仪_HRC大品牌生产厂家 | 化工ERP软件_化工新材料ERP系统_化工新材料MES软件_MES系统-广东顺景软件科技有限公司 | 食品无尘净化车间,食品罐装净化车间,净化车间配套风淋室-青岛旭恒洁净技术有限公司 | 蒸汽热收缩机_蒸汽发生器_塑封机_包膜机_封切收缩机_热收缩包装机_真空机_全自动打包机_捆扎机_封箱机-东莞市中堡智能科技有限公司 | 东风体检车厂家_公共卫生体检车_医院体检车_移动体检车-锦沅科贸 | 民用音响-拉杆音响-家用音响-ktv专用音响-万昌科技 | 仿古建筑设计-仿古建筑施工-仿古建筑公司-汉匠古建筑设计院 | 慢回弹测试仪-落球回弹测试仪-北京冠测精电仪器设备有限公司 | 聚丙烯酰胺_阴离子_阳离子「用量少」巩义亿腾厂家直销,售后无忧 聚合甘油__盐城市飞龙油脂有限公司 | 磁粉制动器|张力控制器|气胀轴|伺服纠偏控制器整套厂家--台灵机电官网 | 开业庆典_舞龙舞狮_乔迁奠基仪式_开工仪式-神挚龙狮鼓乐文化传媒 | 烘箱-工业烘箱-工业电炉-实验室干燥箱 - 苏州华洁烘箱制造有限公司 | 成都网站建设制作_高端网站设计公司「做网站送优化推广」 | 不锈钢酒柜|恒温酒柜|酒柜定制|酒窖定制-上海啸瑞实业有限公司 | 培训中心-翰香原香酥板栗饼加盟店总部-正宗板栗酥饼技术 | NBA直播_NBA直播免费观看直播在线_NBA直播免费高清无插件在线观看-24直播网 | 【甲方装饰】合肥工装公司-合肥装修设计公司,专业从事安徽办公室、店面、售楼部、餐饮店、厂房装修设计服务 | 凝胶成像系统(wb成像系统)百科-上海嘉鹏| 精密五金加工厂-CNC数控车床加工_冲压件|蜗杆|螺杆加工「新锦泰」 |