我们可以用一个库项目作为一个jar文件? [英] Could we use a library project as a jar file?

查看:163
本文介绍了我们可以用一个库项目作为一个jar文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个库项目ABC(即含有一些布局和java文件)机器人。现在,用我的其它应用XYZ这个库项目。目前,我,这样做:选择ABC项目创建它作为库项目遵循的步骤:项目(ABC) - >属性 - > Android->选项(库项目)。
在我的XYZ项目作为库项目加入这个项目。
现在我担心的是,我要要隐藏外部世界这个库项目,这样没有人可以修改这个库项目(如我们使用的jar文件)。我们怎么能实现。任何帮助深表AP preciated。谢谢

I have created a library project "ABC" (that contains some layout and java files) for android. Now using this library project in my other application "XYZ". Currently I, do that: selected "ABC" project created it as library project followed the steps: Project (ABC)->properties-> Android-> selected option (library project). Added this project in my "XYZ" project as a library project. Now my concern is that I want want to hide this library project from outer world so that no one can modified this library project (like we use jar files). How could we achieved. Any help is much appreciated. Thanks

推荐答案

您不能将库项目导出到一个JAR文件即可。为了确保你的项目codeS可以使用的ProGuard

You cannot export a library project to a JAR file. To secure you project codes you can use ProGuard.

为了使您的项目中的ProGuard,编辑project.properties文件

您可以配置您 project.properties 文件

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt

# Project target.
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt //configuring proguard
target=Google Inc.:Google APIs:16 //target api in my case api 16
android.library.reference.1=../actionbarsherlock //indicating you are refering library

其中的细节在以下链接avaialbe

Details of which is avaialbe in the below link

http://developer.android.com/tool​​s/help/proguard.html

请您的项目库项目,你可以参考它在其他的Andr​​oid项目。

Make your project a library project and you can refer it in another android project.

库项目

这些项目包含可共享的Andr​​oid的来源$ C ​​$ C 资源,你可以在Android的项目引用。当你有要重用公共code这是非常有用的。 库项目不能被安装到一个设备,但是,他们被拉入在构建时.apk文件。

These projects contain shareable Android source code and resources that you can reference in Android projects. This is useful when you have common code that you want to reuse. Library projects cannot be installed onto a device, however, they are pulled into the .apk file at build time.

有关详细信息,有主题下看看链接库项目。

For more information have a look at the link under the topic Library Projects.

http://developer.android.com/tool​​s/projects/index.html

您库项目将有打勾,如下图所示的复选框。

Your library project will have a check box ticked as shown below.

您可以到您的Andr​​oid项目添加库项目。右键单击您的项目。转到属性。选择左侧面板上的Andr​​oid。单击添加然后浏览和库项目添加到您的Andr​​oid项目。你可以看到下面一个绿色的勾指示库项目被添加。

You can add library project to your android project. Right click on your project. Goto properties. Choose Android on the left panel. Click add then browse and add the library project to your android project. You can see below a green tick indicating the library project is added.

这篇关于我们可以用一个库项目作为一个jar文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆