ant打包出错 ant\build.xml:698: null returned: 1

  昨天在服务器上使用ant打包突然出现BUILD FAILED 一直都在项目中使用的脚本是不可能出错的,自己电脑上也出现过类似情况,当时clean了几次发现还是失败,重启eclipse 和电脑 重新试了下,OK了,之后就没再care。现在突然在服务器这台电脑上又出现了,重复之前在自己电脑上的操作发现不起作用。

       错误内容:

   BUILD FAILED
D:\Android\sdk\tools\ant\build.xml:601: The following error occurred while executing this line:
D:\Android\sdk\tools\ant\build.xml:653: The following error occurred while executing this line:
D:\Android\sdk\tools\ant\build.xml:698: null returned: 1

      网上搜索资料发现有出现类似情况的知己大笑 

      使用查找到的解决方案  :修改sdk 》tools》ant》build.xml文件中的<property name="aapt.ignore.assets" value="crunch" />

       主工程不报错了,但依赖的工程报了同样的错误。

       仔细阅读了下 build.xml中对  aapt.ignore.assets 的说明

      <!-- 'aapt.ignore.assets' is the list of file patterns to ignore under /res and /assets.
         Default is "!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
         Overall patterns syntax is:
           [!][<dir>|<file>][*suffix-match|prefix-match*|full-match]:more:patterns...
         - The first character flag ! avoids printing a warning.
         - Pattern can have the flag "<dir>" to match only directories
           or "<file>" to match only files. Default is to match both.
         - Match is not case-sensitive.

       这个值主要是打包过程中忽略 res  assets目录下 匹配规则的文件 默认忽略 “!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~” 这类文件

       如果直接设置成 crunch 对其他工程会有影响。

       网上有大神给出 答案

直接修改了sdk里面的配置,个人觉得不太妥,那么可以在自己项目的根目录下build.xml文件中加入:                <property name="aapt.ignore.assets" value="!.svn:!.git:\x3Cdir\x3E_*:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~:crunch" />

这样子就只对自己的项目生效!
为什么会有\x3Cdir\x3E这个东西,其实就是<dir>,不过ant build.xml中不允许使用'<'字符,所以要转义一下。

       直接拷贝了上面value的值,保存 打包 。发现还是报错。无奈开始怀疑答案,帖子楼下其他人回复使用此方法问题以解决。

       无奈继续寻找解决方案。

       最终发现:

       <property name="aapt.ignore.assets" value="&lt;dir&gt;crunch:!.svn:!.git:.*:&lt;dir&gt;_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~" />

      解决问题。

     对比上面查找的答案,发现 <dir> 的写法不同。

     第一种方案,根据帖子回复能解决大部分问题。

     第二种方案,解决了我出现的问题。此处记录下,有遇到相同情况的可试试两种情况, 第二种 中没有加入  crunch 有需要的自己加入

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值