打包具有依赖项的Android AAR [英] Packaging Android AAR that has dependencies

查看:472
本文介绍了打包具有依赖项的Android AAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的图书馆打包成aar.

I want to package my library as an aar.

该库具有多个依赖项(通用图像加载器,ORMLite,番石榴...)

The library has several dependencies (universal image loader, ORMLite, guava...)

它也依赖于我编写的另一个库(称为库B").

It also has a dependency for another library that I wrote (call it 'library B').

我有2个问题:

  1. 将要使用我的库的每个人都需要根据库的依赖项(通用图像加载器,ORMLite,番石榴...)添加依赖项
  2. 我是否需要为库B"创建一个单独的aar,并且我的lib用户是否对此具有单独的依赖关系?

推荐答案

将要使用我的库的每个人都需要根据库的依赖项(通用图像加载器,ORMLite,番石榴...)添加依赖项

Will everyone who will use my library need to add dependencies according to the library's dependencies (universal image loader, ORMLite, guava...)

如果您将AAR作为工件以适当的元数据(例如Maven样式的POM文件)在存储库中分发,则不会.元数据将指向您的依赖关系,而构建系统(例如Gradle)将获取依赖关系.

Not if you are distributing your AAR as an artifact in a repository with appropriate metadata (e.g., Maven-style POM file). The metadata will point to your dependencies, and build systems (e.g., Gradle) will pull in the dependencies.

我需要为库B"创建一个单独的aar吗?

Do I need to create a separate aar for 'library B'

是的,否则除非您消除它并将其代码折叠到您的第一个库中,否则没有人可以访问它.

Yes, otherwise nobody will have access to it, unless you eliminate it and fold its code into your first library.

我的lib用户是否有单独的依赖项?

and have users of my lib have a separate dependency for it?

有关设置依赖性的信息,请参见上文.

See above for setting up dependencies.

这篇关于打包具有依赖项的Android AAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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