简体   繁体   English

如何为Android发送库

[英]How to ship library for Android

I want to develop a library for Android. 我想为Android开发一个库。 In what form can I ship it? 我可以以什么形式发货? jar, apk or something else? 罐子,apk或其他? How should I do it so that other developers can use my library in their application? 我该怎么做才能让其他开发人员在他们的应用程序中使用我的库?

If your library is pure Java code, a JAR is fine, perhaps ZIPped with documentation, etc. 如果你的库是纯Java代码,那么JAR就可以了,也许用文档编写ZIP等。

If you need resources or other Android-specific non-Java stuff, you should look at using an Android library project . 如果您需要资源或其他Android特定的非Java内容,您应该考虑使用Android库项目 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. 正在开发的新的基于Gradle的构建系统应该可以更容易地创建以二进制(非源)形式提供的库项目。

As a regular jar. 作为一个普通的罐子。 Your library classes will be converted to the Dalvik VM bytecode along with a concrete application. 您的库类将与具体应用程序一起转换为Dalvik VM字节码。

I would just toss your code up on link text and allow users to download the code or fork it from there. 我只是将你的代码放在链接文本上,并允许用户下载代码或从那里分叉。 I've seen quite a few Android libraries on GitHub. 我在GitHub上看过很多Android库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM