简体   繁体   English

如何将带有资源的android库项目转换为jar?

[英]How to convert android library project with resources to jar?

Hi I had created an android library project. 嗨,我已经创建了一个android库项目。 Now I want to distribute my library to others without showing my code. 现在,我想将我的库分发给其他人,而不显示我的代码。 I tried it with converting to jar. 我尝试将其转换为jar。 But its not working because I used resources in the library project. 但是它不起作用,因为我在图书馆项目中使用了资源。 So is there any method to convert library project with resources to jar file ?? 那么有什么方法可以将带有资源的库项目转换为jar文件?? or How can I hide my java code in the project ??? 或如何在项目中隐藏我的Java代码??? please help me with some examples, thanks in advance :) 请帮我举一些例子,在此先感谢:)

You can convert that library file to jar file by running some commands in command prompt : 您可以通过在命令提示符下运行一些命令将该库文件转换为jar文件:

jar -cvf jar-file input-file(s)

jar-file is the file name which will be created so it should have extension .jar For example jar-file是将要创建的文件名,因此应具有扩展名.jar例如

jar -cvf convertedjar.jar myppackagename jar -cvf转换的jar.jar myppackagename

Please refer this link: 请参考以下链接:

http://docs.oracle.com/javase/tutorial/deployment/jar/build.html http://docs.oracle.com/javase/tutorial/deployment/jar/build.html

First create a jar from your project and then create a new project and add your resources to that project also put your jar in libs folder of new project. 首先从您的项目中创建一个jar,然后创建一个新项目并将您的资源添加到该项目中,然后将jar放入新项目的libs文件夹中。 leave the manifest file as it is. 清单文件保持原样。

You can see the example in google_play_service_lib which is in extra folder in your sdk. 您可以在sdk额外文件夹中的google_play_service_lib中看到示例。

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

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