Eclipse ANT 项目中的 AAR [英] AAR in Eclipse ANT project

查看:28
本文介绍了Eclipse ANT 项目中的 AAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在eclipse ant项目中使用.aar库(带资源)?我知道没有像在 gradle 中那样使用 .aar 格式的简单方法,但也许有一些解决方法可以解压缩它并手动导入它?

is there any way to use .aar library (with resources) in eclipse ant project? I know that there is no simply way to use .aar format like in gradle, but maybe there is some workaround to unzip it and import it manually?

推荐答案

这个解决方案对我很有帮助

This solution was helpful for me

.aar 文件只是一个包含以下内容的 zip 文件:

A .aar file is simply a zip file with the following contents:

  1. AndroidManifest.xml(必需文件)
  2. classes.jar(必需文件)
  3. Res/(必填文件夹)
  4. R.txt(必需文件)
  5. 资产/(可选文件夹)
  6. libs/*.jar(文件夹选项)
  7. jni//*.so(可选文件夹)
  8. proguard.txt(可选文件)
  9. lint.jar(可选文件)

您看,在 .aar 文件中,您拥有在 eclipse 中操作库所需的一切.

You see, within the .aar file you have everything you need to operate the library in eclipse.

创建库:

  1. 为您的工作区创建一个新项目(以下简称库项目).不要忘记将其标记为库.
  2. 保留空的src文件夹库项目.
  3. .aar 解压缩文件.您可以将其重命名为 .zip 并解压缩或使用任何工具.
  4. 将文件classes.jar复制到libs文件夹库项目中.
  5. Res 文件夹将库项目替换为 .aar res 文件夹.
  6. 您创建的项目几乎包含了您需要的一切.

现在让我们看看如何配置您的项目以引用库项目.

Now let's see how to configure your project to reference the library project.

  1. 在您要使用的项目中,作为依赖库项目添加的库(以下称为项目目标).
  2. 打开文件中的 AndroidManifest.xml .aar 并确保复制所需的一切(许可证、活动、服务、接收器...)在文件 AndroidManifest.xml 项目目标中.
  3. 如果有,复制assets文件夹目标项目中文件夹assets.aar文件的全部内容.
  4. 如果有,复制.aar libs文件夹中文件的全部内容在文件夹 libs 目标项目中.

  1. In the project you want to use the library (henceforth, project goal ) added as the dependency library project .
  2. Open AndroidManifest.xml .aar within the file and make sure to copy everything it takes (permits, activities, services, receivers ...) in the file AndroidManifest.xml project objective .
  3. If there is, copy the entire contents of the folder assets .aar file in the assets folder target project .
  4. If there is, copy the entire contents of the file .aar libs folder in folder libs target project .

清理工作区并重新编译.

Make a Clean the workspace and recompiled.

http://www.iphonedroid.com/blog/utilizar-ficheros-aar-en-eclipse/#.Vh3krye1Gko

这篇关于Eclipse ANT 项目中的 AAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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