Artem
Artem

Reputation: 4639

Error:Some file crunching failed, see logs for details afer update gradle

Afer update gradle version to classpath 'com.android.tools.build:gradle:2.3.0' I got this error.

Error:Some file crunching failed, see logs for details
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: Some file crunching failed, see logs for details

AAPT err(Facade for 596378712): \\?\C:\Users\Я\.android\build-cache\2fe51ff37440fab8f5f875609a799aebf31c9e02\output\res\drawable-xxxhdpi-v4\abc_ic_menu_share_mtrl_alpha.png ERROR: Unable to open PNG file
AAPT err(Facade for 596378712): \\?\C:\Users\Я\.android\build-cache\2fe51ff37440fab8f5f875609a799aebf31c9e02\output\res\drawable-xxxhdpi-v4\abc_tab_indicator_mtrl_alpha.9.png ERROR: Unable to open PNG file
AAPT err(Facade for 596378712): \\?\C:\Users\Я\.android\build-cache\2fe51ff37440fab8f5f875609a799aebf31c9e02\output\res\drawable-hdpi-v4\abc_btn_radio_to_on_mtrl_015.png ERROR: Unable to open PNG file

I'm not using 9.png files. How can I fix it?

Upvotes: 5

Views: 22429

Answers (8)

jenlai1345
jenlai1345

Reputation: 31

In my case, it was some corrupted PNG file in resources too. Try going through all of your images and see if you are able to view them in some external preview program.

Upvotes: 0

DanialAbdi
DanialAbdi

Reputation: 327

The problem is related to 1 corrupted image file in drawable. I changed it and the problem was solved very quickly. The answer is very simple, but the error message is rather ambiguous. I changed the gradle and android studio, but the solution was very simple than what I thought.

Upvotes: 0

Antoine M
Antoine M

Reputation: 31

Check your png files, in my case that was the problem (One picture was a JPEG file with .png at is end) Remove it/them and remplace it/them by "real" png files and it may works

Upvotes: 2

user1578835
user1578835

Reputation: 43

I ran into the same situation as @wooldridgetm.

Later I found that if my 9-patch file has marked stretch area for both left and top side, not only one side, then the problem is solved.

I don't know if it is allowed to have only one side before. Hope this help.

Upvotes: 1

wooldridgetm
wooldridgetm

Reputation: 2520

I started getting this error too with Android Studio 2.3 on Mac. Neither disabling the buildCache nor changing the location of the buildCache resolved the problem.

Renaming all of my 9-patch drawables from 'xyz.9.png' to 'xyz.png' - removing the '.9' in the filename - fixed the problem.

Upvotes: 2

cypark
cypark

Reputation: 96

I have exactly same problem in Android Studio 2.3. I wasted 2 days to solve this problem.

Your problem is

AAPT err(Facade for 596378712): \\?\C:\Users\Я\.android\build- .....

Folder name of your account(reverse R?) is not ascii folder name, so build-cache cannot recognize your folder.

To Solve:

  1. Change folder name : it's impossible in windows 10.
  2. not use build cache: Leos Literak's answer. not good solution.
  3. Best solution: change build-cache path. refer to https://developer.android.com/studio/build/build-cache.html

For Ex:

in gradle.properties
android.buildCacheDir=D:/android-studio/build-cache

You can build your app cleanly. Thanks.

Upvotes: 8

Leos Literak
Leos Literak

Reputation: 9474

I have upgraded to Studio 2.3 as well and this error suddenly occured.

AAPT: \\?\C:\Users\Leoš\.android\build-cache\ce4c6faf7b6acf7c9a9f7875a69dc5776c2cfd5b\output\res\drawable-xhdpi-v4\msbp_math_compass.png ERROR: Unable to open PNG file

I realized one similarity in your and my logs: non-ASCII characters in user name. Then I found that it is a build cache directory. And there was info how to turn it on. So I tried to turn it off with:

gradle.properties

android.enableBuildCache=false

And it works! I can compile my project again. I submitted issue 236304 to Google.

Another option is to change build cache location:

android.enableBuildCache=true
android.buildCacheDir c:\\Dev\\Android\\cache\\

Upvotes: 6

MohammedAlSafwan
MohammedAlSafwan

Reputation: 902

The path of the file might be too long for the compiler to build with it. Try moving your project to another location to reduce the length of the destination.

Upvotes: 1

Related Questions