I cannot add a ninepatch png to my project because of this build error:
Information:Gradle tasks [:app:assembleDebug] 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 Information:BUILD FAILED Information:Total time: 11.955 secs
Information:2 errors Information:0 warnings Information:See complete
output in console
Fact: I have already added one which runs perfectly, the other one is made with the very same methodology, same boundaries and stuff yet makes build error.
I have tried:
- Clean
- Rebuild project
- Restart AS
- Restart PC
- Made nine patch with Photoshop
- Made nine patch with AS built in nine patch maker
- Various naming conventions
- Shorten the dir path of the project
- Adding crunch: false to gradle
Extra wtf:
- If i just copy the pixel contents of the not working nine patch to the working one the error appears.
Also, the error says “see logs”
Where are the logs???
Because its not in logcat thats for sure.
Please help if you can. This drives me nuts.
Im really interested why I have to spend half a day with an image import.
5
Answers
Try adding this to your app
build.gradle
fileI have collected some sollutions. Please check one by one. Hope it may help you.
Suggestion#1:
This is caused by the path length restriction. I think it’s 256 characters maximum.
Relocate your project and the build will succeed.
Resource Link: https://stackoverflow.com/a/25209204
Suggestion#2:
Sometimes .9.png images are corrupted. So you can replace it in your drawables directory.
Resource Link: https://stackoverflow.com/a/41380118
Suggestion#3:
Best solution is changing the buildDir in build.gradle:
For example:
Rebuild and happy coding.
Resource Link: https://stackoverflow.com/a/41877283
Suggestion#4:
You can diagonse by the following command:
Once that finished, Open the buildLog.txt file, and searched for "Error" (no quotes in actual search). Then you will find those files are having problems, and then removed it from the appropriate folder, and then re-run the command above until you didn’t get any errors.
Resource Link: https://stackoverflow.com/a/36648743
Suggestion#5:
file >> invalidate caches/restart
Suggestion#6:
to:
same problem is also coming in
'com.android.tools.build:gradle:1.5.0'
. On that case downgrade it.Resource Link: https://stackoverflow.com/a/31638208
Suggestion#7:
for anyone having the same problem. this solved the issue for me:
"aapt" IOException error=2, No such file or directory" why can't I build my gradle on jenkins?
It’s an issue with 64-bit OS, because aapt isn’t available you have to install these 2 packages:
Resource Link: https://github.com/facebook/react-native/issues/7320
I had the same problem, deleting the right and the bottom borders of the 9-patch png file fixed the problem.
I had similar problem , The Log was shown in Gradle Console for me . The problem for me was that the nine patch image was wrong, it had 2 vertical paddings at right . I removed 1 vertical padding and it worked fine.
I had same problem. Errorenous 9patch was forgotten into mipmap folder..