【问题标题】:Android ant build failing on xxhdpi folderAndroid ant 构建在 xxhdpi 文件夹上失败
【发布时间】:2013-01-16 09:40:33
【问题描述】:

使用我当前的 android 工具,我能够在 Eclipse 中构建一个 android 项目。当我尝试从命令行使用 ant 构建相同的项目时,它会失败并显示以下输出:

-build-setup:
     [echo] Creating output directories if needed...

-pre-build:

-code-gen:
     [echo] ----------
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [aapt] invalid resource directory name: /data/project/res/drawable-xxhdpi

BUILD FAILED
/android-sdk-mac_x86/tools/ant/build.xml:485: The following error occurred while executing this line:
/android-sdk-mac_x86/tools/ant/build.xml:560: The following error occurred while executing this line:
/android-sdk-mac_x86/tools/ant/build.xml:589: null returned: 1

据我了解,drawable-xxhdpi 现在是一种受支持的格式,那么为什么它在 Eclipse 中有效但在 ant 中无效?

== 编辑(添加我的 project.properties 文件)== 这是我的 project.properties 文件中的内容:

 android.library.reference.1=resources/
 android.library.reference.2=../promotion
 # Project target.
 target=android-8
 android.library.reference.3=resources/
 android.library.reference.4=resources/

【问题讨论】:

  • 我的猜测:您在 ant 脚本中设置了错误的 sdk 目标。尝试 android update project 并给它正确的目标。
  • 感谢蒂姆的建议。我已经为项目及其库文件夹运行了 android 更新项目,但无济于事。
  • 介意显示你的 project.properties 吗?
  • 更新了原始帖子以包含我的 project.properties 文件。

标签: java android ant


【解决方案1】:

您在 ant 脚本/project.properties 中设置了错误的 sdk 目标。 Android 4.2 的 SDK 版本为 17,您使用 SDK 版本 8 编译,即 Android 2.2。

使用它来更新您的项目:

android更新项目--target 正确的目标

您可以使用android list targets 列出可用的目标。

或者,只需更新您的 project.properties 并手动将 SDK 版本设置为 17(或您要编译的任何 android sdk):

target=android-17

【讨论】:

    【解决方案2】:

    更新你的 AAPT ,我刚刚解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-04
      • 2016-05-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多