如何库船为AndroidAndroid

2023-09-05 03:52:25 作者:始于喜欢终于你

我要开发Android的一个图书馆。以什么形式,我可以出货?罐子,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 code,一个JAR是好的,也许是压缩与文档等。

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

如果你需要的资源或其他Android特有的非Java的东西,你应该看看使用的 Android的库项目。这是最好的出货源$ C ​​$ C,但也有技巧包装起来的(主要)二进制形式。而正在开发的新摇篮 - 基于构建系统应该更容易创建出货二进制(非源)形式库项目。

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.