简体   繁体   English

库添加依赖android

[英]Libs add dependency android

I'm facing an issues about import aar file, which compile another one, and IDE request compile them also. 我遇到有关导入aar文件的问题,该文件会编译另一个文件,并且IDE要求也对其进行编译。 Here is my problem: I create a module, it's "mylibs". 这是我的问题:创建一个模块,它是“ mylibs”。 Mylibs compile another one. Mylibs会编译另一个。 In my case is timber (libs about logging). 就我而言,是木材(有关伐木的知识)。 Then i create a aar file from Mylibs and import it in mainProject by below code: 然后我从Mylibs创建一个aar文件,并通过以下代码将其导入mainProject中:

compile(name: 'mylib', ext: 'aar') { transitive = true }

After rebuilt, IDE request me must be import timber also. 重建后,IDE要求我也必须进口木材。 I dont understand why i need import timber lib ? 我不明白为什么我需要进口木材库?

aar files do not include dependencies. aar文件不包含依赖项。 If they are shipped through a repository, there usually is a pom file in the same repo which describes the dependencies. 如果它们是通过存储库提供的,则通常在同一仓库中有一个pom文件,该文件描述了依赖性。 In this case gradle can resolve transitive dependencies automatically. 在这种情况下,gradle可以自动解决传递依赖关系。

But if you ship an aar locally, there are no informations on dependencies available, so you have to include them manually. 但是,如果您在本地运送aar ,则没有可用依赖项的信息,因此您必须手动添加它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM