gpt4 book ai didi

android - 仅使用 maven 创建 Android 归档库 (AAR)

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:23:16 24 4
gpt4 key购买 nike

我正在开发一个库项目,我想将其分发给其他开发人员。

网上有很多关于这个话题的讨论,人们建议创建一个分发版本库项目,它只包含我的库项目的 jar 和其他资源。听起来不错。

然后,我突然发现有人建议创建Android Archive Library (AAR)。但是他们都使用了一个叫Gradle的工具

我将 Eclipse 与 Maven 一起用于我的 Android 库项目。我的问题是,是否可以不使用 Gradle 而只使用 Maven 为我的 android 库项目生成 AAR 实现?如果是这样,如何?

最佳答案

android-maven-plugin 允许将项目打包为 aar 文件。

来自他们的文档 http://simpligility.github.io/android-maven-plugin/ :

Produce an AAR

If you have a bunch of Java code that you want to share then the best solution is to create a Java project and publish as a plain Java archive (ie jar).

But if you have code plus Android resources that you want to share then you really want to share that as an Android archive (ie AAR). Fortunately this is easy.

Just add configure your project to have packaging aar (and add the android-maven-plugin to build/plugins section of your maven project). Eg

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycoolcompany</groupId>
<artifactId>general-lib</artifactId>
<version>1.2.3-SNAPSHOT</version>
<packaging>aar</packaging>

...
</project>

关于android - 仅使用 maven 创建 Android 归档库 (AAR),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25077131/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com