AAPT: \\?\C:\Users\平\.android\build-cache\9db38be22f181493e9a5369a6fdf45066821c4c7\output\res\drawable-xhdpi-v4\abc_list_pressed_holo_light.9.png ERROR: Unable to open PNG fileAAPT: \\?\C:\Users\平\.android\build-cache\9db38be22f181493e9a5369a6fdf45066821c4c7\output\res\drawable-hdpi-v4\abc_ic_star_half_black_48dp.png ERROR: Unable to open PNG fileAAPT: \\?\C:\Users\平\.android\build-cache\9db38be22f181493e9a5369a6fdf45066821c4c7\output\res\drawable-mdpi-v4\abc_btn_switch_to_on_mtrl_00012.9.png ERROR: Unable to open PNG file...AAPT err(Facade for 1178074264) : No Delegate set : lost message:\\?\C:\Users\平\.android\build-cache\9db38be22f181493e9a5369a6fdf45066821c4c7\output\res\drawable-mdpi-v4\abc_ic_menu_cut_mtrl_alpha.png ERROR: Unable to open PNG fileAAPT err(Facade for 1178074264) : No Delegate set : lost message:\\?\C:\Users\平\.android\build-cache\9db38be22f181493e9a5369a6fdf45066821c4c7\output\res\drawable-hdpi-v4\notification_bg_normal_pressed.9.png ERROR: Unable to open PNG fileAAPT err(Facade for 1178074264) : No Delegate set : lost message:\\?\C:\Users\平\.android\build-cache\9db38be22f181493e9a5369a6fdf45066821c4c7\output\res\drawable-hdpi-v4\abc_list_pressed_holo_dark.9.png ERROR: Unable to open PNG file...FAILURE: Build completed with 2 failures.1: Task failed with an exception.-----------* What went wrong:Execution failed for task ':Volley:mergeDebugAndroidTestResources'.> Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: * Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.==============================================================================2: Task failed with an exception.-----------* What went wrong:Execution failed for task ':agora:mergeDebugAndroidTestResources'.> Error: Some file crunching failed, see logs for details

Android Studio 从2.2升级到2.3后,因为svn地址迁移所以重新导入项目,发现报了如上的错误。
进入到报错的目录可以发现这些.9的图片都是存在且是正常的.9图片;而且这些图片并不是我倒入进去的,而是V7或引用其他的库编译时自动生成的。
试了百度里面很多办法都没能解决,最后在伟大的stackoverflow上面找到了解决方案,在文末附上链接。下面记录下尝试过的办法(stackoverflow也有写):
1. 排查是否有不合格的.9图片。(实际上报错图片不是手动引入的)
2. 检查png图片是否合格。(比如由jpg直接改后缀的,而不是导出的)
3. 在build.gradle加入设置:

aaptOptions {    cruncherEnabled = false    useNewCruncher=false}

4. 清除报错路径缓存
5. clean或者rebuild项目

以上的方法都不能解决这个问题,下面说下stackoverflow上的解决办法:
1. According to release notes of Android Studio version 2.3, build cache is enabled by default.
2. so we should disable this setting. Here is official guide, Android Studio/User Guide/build-cache(linkhttps://developer.android.com/studio/build/build-cache.html).
3. go to gradle.properties file, and disable build cache.
// To re-enable the build cache, either delete the following
// line or set the property to ‘true’.
android.enableBuildCache=false
the other way is to modify build cache dir by adding
//first line can be skipped because true is the default value by 2.3
android.enableBuildCache=true
android.buildCacheDir =c:\temp\

翻译过来就是:
1. 根据Android Studio版本2.3的发行说明,默认情况下启用构建缓存。
2. 所以我们应该禁用这个设置。这是官方指南,Android Studio/User Guide/build-cache(链接https://developer.android.com/studio/build/build-cache.html)。
3. 打开gradle.properties文件,并禁用构建缓存。
android.enableBuildCache=false
另一种方法是通过添加以下代码来修改构建缓存目录
//first line can be skipped because true is the default value by 2.3
android.enableBuildCache=true
android.buildCacheDir =c:\temp\

以上问题解决,可以通过编译。
Stackoverflow问题地址:
http://stackoverflow.com/questions/42622654/some-file-crunching-failed-mergedebugresources-failed

更多相关文章

  1. Android(安卓)框架学习4:一次读懂热门图片框架 Picasso 源码及流
  2. 利用HTML5开发Android笔记(下篇)
  3. Android图文混排实现方式详解
  4. 关于android中网络图片下载中oom解决开源框架Afinal的探究
  5. Android中图片Bitmap的缩放
  6. Android高手进阶教程(二十二)之---Android中几种图像特效处理的
  7. Android(安卓)App 性能优化之图片优化
  8. 常用组件:android的图片组件ImageView
  9. Android移动图片

随机推荐

  1. Android调用系统分享
  2. android 音频总结
  3. android:layout_weight 使用
  4. android 设置系统屏幕亮度
  5. Android(安卓)添加永不休眠
  6. 【Android】Web开发之通过标准Java接口处
  7. Android和H5混合开发(一)
  8. android rom
  9. Android中Service(服务)详解
  10. Android(安卓)getSystemService