我一直在纺纱一罐的Android库项目,包括这个jar在我的其他应用程序。但是,上developer.android.com ,我看到这样的说法,我可以T分发库在一个罐子里:
I've been spinning a jar for android library project and including this jar in my other apps. But on developer.android.com, I see this statement that I can't distribute a library in a jar:
您不能库项目导出到一个JAR文件一个库无法散发为二进制文件(如JAR文件)。 这将在SDK工具的未来版本中加入。
A library cannot be distributed as a binary file (such as a JAR file). This will be added in a future version of the SDK Tools.
我真不明白是什么意思。
I really don't understand what does that mean.
它可以创建一个Android库项目,不 包括源$ C $ C。局限性是:
It is possible to create an Android library project that does not include source code. The limitations are:
您还是要出货的资源。
You still have to ship the resources.
您必须重写你的code,以避免使用R.值,因为它们 将是错误的。你将不得不使用查找所有的资源标识 getResources()。则getIdentifier()和/或反射。
You have to rewrite your code to avoid using R. values, as they will be wrong. You will have to look up all resource IDs using getResources().getIdentifier() and/or reflection.
我要高级的Android的的忙碌codeR说明书中的说明 发展的( http://commonsware.com/AdvAndroid ),虽然 说明新的不够,没有我的免费版本有他们。 引用一些指令从当前版本:
I have the instructions in The Busy Coder's Guide to Advanced Android Development (http://commonsware.com/AdvAndroid), though the instructions are new enough that none of my free versions have them. Quoting some of the instructions from the current edition:
您可以通过以下步骤创建一个二进制只有库项目:
"You can create a binary-only library project via the following steps:
创建一个Android库项目,与源$ C $ c和这样的 -
这是你的主项目,从中你将创建一个版本
库项目的分布情况。
Create an Android library project, with your source code and such – this is your master project, from which you will create a version of the library project for distribution.
编译Java源代码(例如,蚂蚁编译),并把它变成一个JAR文件
Compile the Java source (e.g., ant compile) and turn it into a JAR file
由此产生的分配的Android库项目将拥有一切一 主体工程需要,只是没有源$ C $ C。
The resulting distribution Android library project will have everything a main project will need, just without the source code."
就个人而言,我只是稍等一下。我希望官方 支持库项目-AS-JAR文件将提供soonish。
Personally, I'd just wait a bit. I am hopeful that the official support for library-projects-as-JARs will be available soonish.