如何使用资源添加Android库而不使用Eclipse [英] How to add Android libraries with resources without using Eclipse

查看:129
本文介绍了如何使用资源添加Android库而不使用Eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安装Android v7 appcompat库以使用ActionBar。在

I would like to setup the Android v7 appcompat library in order to use the ActionBar. At

http://developer.android .com / tools / support-library / setup.html#

有一个教程如何使用Eclipse添加资源库。由于我不使用Eclipse,我想通过手动编辑和复制所需的文件来添加库和附带的资源。任何人都可以提供这些必要的步骤?

there is a tutorial how to add libraries with resources using Eclipse. Since I am not using Eclipse I would like to add the library and the accompanying resources by manually editing and copying the required files. Can anyone perhaps provide me with this necessary steps?

推荐答案

好的,终于找到了。这些关键字是库项目命令行

OK, finally I found it out. The keywords are library project and command line.

为了使用命令行将appcompat v7作为库项目添加到自己的项目中,以下步骤适用于我:

In order to add the appcompat v7 as library project to an own project using the command line the following steps worked for me:


  1. 将自己的文件夹 android-sdk / extras / android / support / v7 / appcompat 项目空间。您可以将其称为任何内容,我们将保留 appcompat 名称。

  1. Create a copy of the folder android-sdk/extras/android/support/v7/appcompat into the own project space. You may call it anything, we will keep the appcompat name.

cd my_project

cd my_project

cp -r android-sdk / extras / android / support / v7 / appcompat appcompat

cp -r android-sdk/extras/android/support/v7/appcompat appcompat

生成一个构建。图书馆项目的xml 文件:执行

android更新lib-project --path appcompat

android update lib-project --path appcompat

引用库项目并在项目的 project.properties 文件中创建依赖项

reference the library project and create the dependency in the project's project.properties file

android.library .reference.1 = appcompat

android.library.reference.1=appcompat

构建主项目:

ant clean debug

ant clean debug

这也将自动构建支持库。
添加库或更改目标版本后,您通常需要一个干净的构建,所以该构建会取得所有更改。

This will automatically build the support library, too. You generally need a clean build after adding a library or changing the target versions, so the build picks up all the changes.

这些是有用的资源:

  • http://developer.android.com/tools/projects/projects-cmdline.html
  • Adding android library project to an android project prevents Ant from building

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

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