【问题标题】:Build android application with a library using ant使用 ant 使用库构建 android 应用程序
【发布时间】:2012-01-14 07:43:11
【问题描述】:

我有 2 个项目(源代码)。项目 A 是未编译的库,项目 B 使用该库。我想用 ant 编译它。我正在使用 android update 来进行这样的设置。

android 更新 lib-project --target 2 --path c:\Android-Build\A

android 更新项目 --target 2 --path c:\Android-Build\B --library ..\A

在项目 B 的 libs 文件夹中,我什么都没有。我正在使用的所有库都在库 (A) 上。使用eclipse一切正常。

如何使用 ant 进行编译。

ant 调试抛出错误。库 (A) 首先编译(生成 bin 和 gen 文件夹)。

但是当涉及到要编译的项目 B 时,无法从库中找到导入。 我如何告诉 ant 在构建过程中将库包含到项目 B 中?太棒了。

[javac] C:\Android-Build\B Activity.java:7: 错误:找不到 象征 [javac] 导入 com.a.A;

*更新**


project.properties 用于项目 B。

android.library.reference.1=..\\A
# Project target.
target=Google Inc.:Google APIs:13

project.properties 用于项目 A。

target=Google Inc.:Google APIs:13

\\ 似乎是正确的,因为如果我将其更改为 \ ant 找不到库

【问题讨论】:

  • B项目请加project.properties
  • 嗯,这里没有错。 A项目也请加project.properties
  • 也添加了。我认为这与属性文件没有任何关系。当我构建项目 B 库 A 被编译但 B 不包含该库。

标签: android ant android-build


【解决方案1】:

将下一行添加到您的 A 的 project.properties 文件中:

android.library=true

【讨论】:

  • 非常感谢。就是这样!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-28
  • 2011-11-09
  • 2011-11-06
  • 1970-01-01
  • 2013-09-01
  • 2012-01-20
相关资源
最近更新 更多