Android的依赖关系:apklib VS AAR文件关系、文件、Android、apklib

2023-09-05 05:31:42 作者:不知道该怎么释怀

这是我的理解, apklib 包含code +资源与共享Maven的 AAR 文件分发摇篮

AAR 不同于apklib一个主要方式:类编译并包含在AAR的根classes.jar。而 apklib 不能包含编译的类文件或jar文件。

1有人可以解释VS之间的 apklib 的主要区别 AAR 文件?

2能的Maven 使用 AAR ?可摇篮使用 apklib

3的格式是更好?

解决方案   

1有人可以解释VS AAR apklib之间的主要区别   文件?

这在我脑海中,除了你说的一对夫妇的差异 AAR 可以包含在情况下,没有源$ C ​​$ c和里面的库一个java的jar 文件夹,你不'吨要提供源$ C ​​$ C(如谷歌播放服务所做的); AAR 可以包含自定义ProGuard的文件和自定义皮棉规则,虽然我不知道他们是考虑到目前。   

2可以使用Maven的AAR?可以用摇篮apklib?

Android的Maven插件支持 AAR 自3.7.0版本。 摇篮不支持使用 apklib 相关性,但你可以导出 Android的库 apklib (见这个帖子)。

Android依赖管理与 搭建

From my understanding, apklib contains code + resource shared with Maven . aar files are distributed by Gradle.

The aar differ from apklib in one major way : classes are compiled and included in a classes.jar in the root of the aar. Whereas apklib cannot contain compiled class files or jars.

1 Can somebody explain the main differences between apklib vs aar files ?

2 Can Maven use aar ? Can Gradle use apklib ?

3 Which format is "better" ?

解决方案

1 Can somebody explain the main differences between apklib vs aar files ?

Couple differences that comes to my mind, in addition to the one you said:

aar can contain no source code and a java jar inside the libs folder in case you don't want to provide the source code (like Google Play Services does); aar can contain custom proguard file and custom lint rules, although I'm not sure they are take into account at the moment.

2 Can Maven use aar ? Can Gradle use apklib ?

The Android Maven Plugin supports aar since version 3.7.0. Gradle doesn't support using apklib dependencies but you could export your android-library as apklib (see this post).