这个问题已经在这里有一个答案:
随着Android的工作室3.X.X,增加本地.AAR文件的Android项目不工作(建设是成功的,但得到的运行时异常)
我尝试下面的方法(摘自参考来源:https://stackoverflow.com/a/23326397/5685911,https://stackoverflow.com/a/24894387/5685911等),但没有为我工作:
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文件导入使用任何上述方法都不会传播。但是,我认为这是不正确的解决方案。任何帮助这里非常感谢理解:)
File name:
C://release.aar
Subproject name
:my_subproject_name应用程序/文件的build.gradle:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':my_subproject_name')
}