如何在Eclipse中添加支持Android V7库? [英] How to add Android Support v7 libraries in eclipse?

查看:661
本文介绍了如何在Eclipse中添加支持Android V7库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在Eclipse中添加支持Android V7库?比如我怎么添加CardView到Eclipse Android项目?

How do I add Android Support v7 libraries in eclipse? For example how do I add CardView to an eclipse android project?

注:这是一个自我的回答问题,所以没有必要浪费你的时间作出答​​复。当然,如果你有什么要补充的,请做。

Note: This was a self answer question, so no need to waste your time making an answer. Of course, if you have anything to add, please do.

推荐答案

从:<一href="https://developer.android.com/tools/support-library/setup.html#libs-with-res">https://developer.android.com/tools/support-library/setup.html#libs-with-res

我知道这看起来像很多步骤,但实际上它只是非常细分,只需要两分钟

I know this looks like a lot of steps, but in reality it's just very broken down and only takes two minutes

添加库的资源 要使用资源(如V7 cardview)增加支持库到应用程序的项目:

Adding libraries with resources To add a Support Library with resources (such as v7 cardview) to your application project:

使用Eclipse

创建库项目基础上,支持库code:

Create a library project based on the support library code:

  • 请确保您已使用SDK管理器下载了Android的支持库。

  • Make sure you have downloaded the Android Support Library using the SDK Manager.

创建库项目,并确保所需要的JAR文件都包含在项目的构建路径:

Create a library project and ensure the required JAR files are included in the project's build path:

选择文件>导入。

选择现有的Andr​​oid code进入工作区,然后单击下一步。

Select Existing Android Code Into Workspace and click Next.

浏览到SDK的安装目录,然后到支持库文件夹。例如,如果要添加的cardview项目,浏览/演员/安卓/支持/ V7 / cardview /.

Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the cardview project, browse to /extras/android/support/v7/cardview/.

点击Finish导入该项目。对于V7 cardview项目,你现在应该看到一个新的项目名为Android的支持-V7-cardview。

Click Finish to import the project. For the v7 cardview project, you should now see a new project titled android-support-v7-cardview.

在新的库项目,展开库/文件夹,右键单击每个.jar文件,并选择Build

In the new library project, expand the libs/ folder, right-click each .jar file and select Build

路径>添加到构建路径。例如,创建了V7 cardview项目的时候,Android的支持-V7-cardview.jar文件添加到构建路径。

Path > Add to Build Path. For example, when creating the the v7 cardview project, add the android-support-v7-cardview.jar file to the build path.

右键单击该库项目文件夹并选择构建路径>配置构建路径。

Right-click the library project folder and select Build Path > Configure Build Path.

在订单和导出选项卡,选中刚刚添加到构建路径的.jar文件,因此它们可用于依赖于该库项目的项目。例如,cardview项目需要您导出了Android支持-V7-cardview.jar文件。

In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the cardview project requires you to export the android-support-v7-cardview.jar file.

不选Android的依赖。

Uncheck Android Dependencies.

点击确定完成修改。

您现在有一个库项目为您选择的支持库,你可以与一个或多个应用程序的项目中使用。

You now have a library project for your selected Support Library that you can use with one or more application projects.

将库添加到您的应用程序项目:

Add the library to your application project:

在项目资源管理器中,右键单击您的项目并选择属性。

In the Project Explorer, right-click your project and select Properties.

在类别面板上的对话框的左侧,选择Android系统。

In the category panel on the left side of the dialog, select Android.

在库窗格中,单击添加按钮。

In the Library pane, click the Add button.

选择库项目,然后单击确定。例如,appcompat项目应列为Android的支持-V7-cardview。

Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-cardview.

在属性窗口中,单击确定。

In the properties window, click OK.

这篇关于如何在Eclipse中添加支持Android V7库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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