我是pretty的新Android开发,但我有Java和Eclipse的一些经验。我在寻找方法来创建可重用的库(控制,助手,标准的活动,等等),我可以在自己的项目中使用,但也可以被分配给其他开发商没有透露来源$ C $ ℃。
通常情况下,我的类文件打包到一个JAR文件和任何其他开发人员可以将其添加到类路径,并使用包装类。
我如何能做到这一点与Android项目?我读过关于Android库项目,但作为文件指出他们不能被打包成一个JAR,但会随着引用库项目的项目编制。这意味着我也有分发源$ C $ C。
我也看到了this帖子,其中询问同样的问题,但没有提供一个满意的答案。
所以:有没有编译和打包了一组类和其他文件(包括XML布局,资源和材料)的一种方式,没有任何来源$ C $ CS分发仅包,以便它可以被引用和使用像一个JAR文件中的任何其他开发?
解决方案我读过关于Android库项目,但作为文件指出,他们不能 打包成一个JAR文件,但将与引用该库的项目编译沿 项目。这意味着我也有分发源$ C $ C。
事实并非如此。这确实需要一些额外的包装工作,但你可以编译code到一个JAR和分发库项目的库/
目录下的JAR。
所以:有没有编译和打包了一组类和其他文件的方式(包括 XML布局,资源和材料),并没有任何来源分发仅包 codeS,以便它可以被引用和由任何其他显影剂使用像JAR文件?
使用一个Android库项目。我有一些东西写在这里描述多一点的封装选择,再加上指向一些包裹跟着其中描述的约定。
I'm pretty new to Android development, but I have some experience with Java and Eclipse. I'm looking for ways to create re-usable libraries (controls, helpers, "standard" activities, etc.) that I could use in my own projects, but that could also be distributed to other developers without disclosing the source code.
Normally, I'd package the class files into a JAR file and any other developer could add it to the classpath and use the packaged classes.
How can I do that with Android projects? I've read about Android Library Projects, but as the documentation states they can not be packaged into a JAR, but will be compiled along with the project that references the library project. This means I also have to distribute the source code.
I've also read this post, which asks about the same question but didn't provide a satisfying answer.
So: Is there a way of compiling and packaging a set of classes and other files (including XML layouts, resources and stuff) and distribute only that package without any source codes so that it can be "referenced" and used like a JAR file by any other developer?
解决方案I've read about Android Library Projects, but as the documentation states they can not be packaged into a JAR, but will be compiled along with the project that references the library project. This means I also have to distribute the source code.
Not true. It does require a bit of extra packaging work, but you can compile your code to a JAR and distribute the JAR in the library project's libs/
directory.
So: Is there a way of compiling and packaging a set of classes and other files (including XML layouts, resources and stuff) and distribute only that package without any source codes so that it can be "referenced" and used like a JAR file by any other developer?
Use an Android library project. I have some stuff written up here that describes a bit more of the packaging options, plus pointers to some "parcels" that follow the conventions described therein.
相关推荐
最新文章