【发布时间】:2013-12-14 01:23:23
【问题描述】:
一段时间以来,我一直在使用 Eclipse 导出创建我的应用程序 .apk,但我现在想使用 ant 进行构建,以便我可以自定义该过程。根据其他地方的建议,我使用“android create project”命令在临时项目中生成合适的 build.xml 文件(然后对其进行修改)。
当我构建时,它在打包步骤中失败并出现重复文件错误:
-package:
[apkbuilder] Current build type is different than previous build: forced apkbuilder run.
[apkbuilder] Creating MyApp-debug-unaligned.apk and signing it with a debug key...
[apkbuilder] Found duplicate file for APK: res/drawable-mdpi/icon.png
[apkbuilder] Origin 1: /home/chris/temp/MyApp/MyApp.ap_
[apkbuilder] Origin 2: /home/chris/git/MyApp/MyApp/res/drawable-mdpi/icon.png
...
/home/chris/android-sdk-linux_x86/tools/ant/build.xml:310: com.android.sdklib.build.DuplicateFileException: Duplicate files at the same path inside the APK
我的蚂蚁属性是:
source.dir=/home/chris/git/MyApp/MyApp
out.dir=/home/chris/temp/MyApp
这似乎是 res 目录的内容与构建期间创建的中间 .ap_ 资源包文件之间的冲突。我不明白为什么包装会包含来自这两个来源的内容,因为重复似乎是不可避免的结果。
我最初认为问题是由 res 子目录(drawable-hdpi、drawable-ldpi、drawable-mdpi)引起的,它们都包含同名文件(icon.png),但我尝试以不同的方式命名这些文件并出现错误仍然发生。在任何情况下,Eclipse 导出构建都可以毫无问题地处理它们。
这个问题看起来很相似 Android aapt duplicate files error when building with ant 但在这种情况下,该人正在创建自己的 build.xml,而我使用的是 android sdk 中提供的那个。
任何帮助将不胜感激。
【问题讨论】:
标签: java android xml eclipse ant