如何在 Android Studio 4.2 上导入 .AAR 模块 [英] How to import .AAR module on Android Studio 4.2

查看:375
本文介绍了如何在 Android Studio 4.2 上导入 .AAR 模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前我用过文件 >新 >新模块导入.JAR/.AAR包

但从新模块向导中导入 .JAR/.AAR 包的选项已在 Android Studio 4.2 上删除,并遵循建议使用

然后在项目级别创建一个名为libs

的新目录

现在右键单击库并选择在查找器中显示,然后将您的 .aar 文件粘贴到此处.

现在在 Build.gradle(Module) 中添加以下实现.

实现文件('../libs/testaarfile.aar')

并关注您的项目.

Previously I used File > New > New Module > Import .JAR/.AAR Package

but the option to Import .JAR/.AAR Package from the New Module wizard has been removed on Android Studio 4.2 and following the document which suggests using the Project Structure Dialog reveals no clear answer for importing .AAR module and seems to be outdated

I tried adding the module as a dependency in the project Structure but it did not work

解决方案

From Android Studio package manager select project:

Then make a new directory in project level named libs

Now right click the libs and select Reveal in finder and then paste here your .aar file.

Now in Build.gradle(Module) add the following implementation.

implementation files('../libs/testaarfile.aar') 

and snyc your project.

这篇关于如何在 Android Studio 4.2 上导入 .AAR 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆