I tried below methods (Taken reference From: https://stackoverflow.com/a/23326397/5685911, https://stackoverflow.com/a/24894387/5685911, etc.), but none worked for me:1. Import the local aar file: (I) File>New>New Module>Import the .AAR Package [On "Finish" click the .AAR gets included automatically into settings.gradle file as below: include ':app', ':myAAR' (II) Add AAR module dependency in app level build.grdle file as below: implementation project(":myAAR")2. Using flatDir method: (I) keep aar file in libs folder (II) Add flatDir{dirs 'libs'} into the project level build.gradle file as below: allprojects { repositories { jcenter() flatDir { dirs 'libs' } } } (III) Add AAR dependency in app level build.gradle file as below: dependencies { implementation(name:'myAAR', ext: 'aar') }解决方法:需要将AAR模块导入的所有库都包含到应用程序级别gradle中.似乎没有使用上述任何一种方法传播从AAR文件导入的内容.但是,我认为这不是正确的解决方案.非常感谢您的任何帮助:) Worked around: Need to include all the library imported by the AAR module into the app level gradle. It seems imports from the AAR file are not propagated using any of the above method.BUT, I think it is not the proper solution. Any help would be appreciated here with a big THANKS :) 推荐答案 打开您要向其添加SDK的android项目点击文件->新模块->导入jar/arr包 File name: C://release.aa r Subproject name: my_subproject_name app/build.gradle 文件: dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation project(':my_subproject_name')}在外部库的项目"选项卡中,您将看到您的库 In result at Project tab in External Libraries you will see your lib 这篇关于使用Android Studio 3.X.X,无法将本地.AAR文件添加到Gradle构建中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-25 04:05