如何使用Ant手动构建包含Android库项目的Android项目?

时间:2012-04-09 05:57:58

标签: android ant

在使用Ant构建项目时,我似乎遇到了麻烦。 QR码扫描器安卓库和我的项目资源的资源似乎没有合并到一个.arsc文件中。这是我剧本的一部分片段。

<exec executable="${aapt}" failonerror="true">
      <arg value="package" />
      <arg value="-M" />
      <arg path="AndroidManifest.xml" />
      <arg value="-A" />
      <arg path="assets" />
      <arg value="-S" />
      <arg path="./res" /> 
      <arg value="-S" />
      <arg path="../QRcode Scanner/res" />
      <arg value="-I" />
      <arg path="${android-platform-jar}" />
      <arg value="-f" />
      <arg value="-F" />
      <arg value="${resources.file}" />
    </exec> 

我的控制台错误日志如下所示: -

android-package-resources:
     [echo] Packaging Android resources into C:\Praveen\Eclipse\eclipse-SDK-3.7.
1-win32-x86_64\workspace\HH3_Standard Mode Application/bin/resources.ap_ ...
     [exec] C:\Praveen\Eclipse\eclipse-SDK-3.7.1-win32-x86_64\workspace\QRcode S
canner\res\values\colors.xml:18: error: Resource at contents_text appears in ove
rlay but not in the base package; use <add-resource> to add.
     [exec] C:\Praveen\Eclipse\eclipse-SDK-3.7.1-win32-x86_64\workspace\QRcode S
canner\res\values\colors.xml:19: error: Resource at encode_view appears in overl
ay but not in the base package; use <add-resource> to add.
     [exec] C:\Praveen\Eclipse\eclipse-SDK-3.7.1-win32-x86_64\workspace\QRcode S
canner\res\values\colors.xml:20: error: Resource at help_button_view appears in
overlay but not in the base package; use <add-resource> to add.
     [exec] C:\Praveen\Eclipse\eclipse-SDK-3.7.1-win32-x86_64\workspace\QRcode S
canner\res\values\colors.xml:21: error: Resource at help_view appears in overlay
 but not in the base package; use <add-resource> to add.
     [exec] C:\Praveen\Eclipse\eclipse-SDK-3.7.1-win32-x86_64\workspace\QRcode S
canner\res\values\colors.xml:22: error: Resource at possible_result_points appea
rs in overlay but not in the base package; use <add-resource> to add.

1 个答案:

答案 0 :(得分:1)

尝试使用这个:

<exec executable="${aapt}" failonerror="true">
  <arg value="package" />
  <arg value="-M" />
  <arg path="AndroidManifest.xml" />
  <arg value="-A" />
  <arg path="assets" />
  <arg value="-S" />
  <arg path="./res" /> 
  <arg value="-S" />
  <arg path="../QRcode Scanner/res" />
  <arg value="-I" />
  <arg path="${android-platform-jar}" />
  <arg value="-f" />
  <arg value="-F" />
  <arg value="${resources.file}" />
  <arg value="--auto-add-overlay" />
</exec>