我必须在Android Studio的子项目中将.aar文件添加为库.它给了我一个错误. [英] I have to add .aar files as a library in a sub project in Android studio. It gives me an error.
本文介绍了我必须在Android Studio的子项目中将.aar文件添加为库.它给了我一个错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经将.aar文件添加到了子项目的libs文件夹中. 并将存储库指定为:
I have added the .aar files to libs folder in the sub-project. And have given the repositories as:
repositories {
mavenCentral()
mavenLocal()
flatDir {
dirs 'libs'
}
此子项目的build.gradle中的
. 我是否还需要在Main项目的build.gradle中添加依赖项? 如果是,该怎么办?
in the build.gradle of this sub-project. Do I need to add dependencies in Main project's build.gradle also? If yes, how should that be done?
推荐答案
在您模块的存储库中:app
In the repositories of your module: app
repositories {
flatDir {
dirs 'libs'
}
}
在模块的依赖项中添加以下内容:app 如果您同时拥有JAR文件和AAR文件,请执行以下操作.
Add the following in the dependencies of your module: app In the case that your have both a JAR and an AAR file, do the following.
dependencies
{
implementation (name: '***library name***', ext: 'aar')
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'], )
}
这篇关于我必须在Android Studio的子项目中将.aar文件添加为库.它给了我一个错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文