如何为 Android 发布库 [英] How to ship library for Android

查看:38
本文介绍了如何为 Android 发布库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 Android 开发一个库.我可以用什么形式发货?jar、apk 还是别的什么?我该怎么做才能让其他开发者在他们的应用程序中使用我的库?

I want to develop a library for Android. In what form can I ship it? jar, apk or something else? How should I do it so that other developers can use my library in their application?

推荐答案

如果你的库是纯 Java 代码,JAR 就可以了,也许是压缩文档等.

If your library is pure Java code, a JAR is fine, perhaps ZIPped with documentation, etc.

如果您需要资源或其他 Android 特定的非 Java 内容,您应该考虑使用 Android 库项目.这最好作为源代码提供,尽管有一些技巧可以将它打包成(主要是)二进制形式.正在开发的基于 Gradle 的新构建系统应该可以更轻松地创建以二进制(非源代码)形式发布的库项目.

If you need resources or other Android-specific non-Java stuff, you should look at using an Android library project. That is best shipped as source code, though there are tricks for packaging it up in (mostly) binary form. And the new Gradle-based build system under development should make it easier to create library projects that ship in binary (non-source) form.

这篇关于如何为 Android 发布库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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