Error:Execution failed for task ':ProjectName:mergeDebugResources'. > Crunching Cruncher *some file* failed, see logs

后端 未结 22 2361
Happy的楠姐
Happy的楠姐 2020-11-29 07:49

I have this error when trying to make a module of a project

apply plugin: \'com.android.library\'

android {
    compileSdkVersion 17
    buildToolsVersion \         


        
相关标签:
22条回答
  • 2020-11-29 08:26

    It may happens because fake png files. You can use this command to check out fake pngs.

    cd <YOUR_PROJECT/res/> && find . -name *.png | xargs pngcheck
    

    And then,use ImageEditor(Ex, Pinta) to open fake pngs and re-save them to png.

    Good luck.

    0 讨论(0)
  • 2020-11-29 08:27

    After using pngcheck and resave all my image files to *.png, the problem still.

    Finally, I found the issue is about *.9.png files. Open and check all your 9-Patch files, make sure that all files have black lines as below, if don't have, just click the white place and add it, then save it.

    0 讨论(0)
  • 2020-11-29 08:28

    I had the same problem, but look at this image and I`m sure u can find the answer in such situation...the problem was in a png file. when I fixed what android studio asked me, it worked. I hope it works for U too. click this photo... it shows where is the problem and what it is

    0 讨论(0)
  • 2020-11-29 08:29

    I was also stuck by this problem.But in my case I delete all .png images from drawable folder ,clean and rebuild application and then paste all .png images to my drawable, rebuild again. It worked fine for me.

    0 讨论(0)
  • 2020-11-29 08:31

    You can get this error if you have invalid 9-patch files. If there is anything apart from black and transparent in the border pixels you will get this error. The easiest way of fixing this is to open it up in Android Studio and modify the borders. Just adding and removing one pixel is enough.

    It's worth noting that you won't see the bad pixels in AS, as the editor sets anything not black to transparent, but you will need to modify the file for it to save these changes.

    0 讨论(0)
  • 2020-11-29 08:34

    Additional to all answers, I think it could have similar problems. My Problem was caused by png.9 files. If this files, have a (in my case) too small stretching area with just a few pixels, the building failed with this error also. I have checked all these answers, but nothing helped. Giving a little bit bigger stretching area, solved the problem. I tested it many times, allways when I use small stretching areas it failed. So I am sure, it will help some poeple to make the stretch area a little bit bigger.

    The second problem, but this is just an assumption, is the icon name (maybe only for png.9 files too). For examle, I used an image named folder_icon.9.png , with this one, it allways failed. Renaming it to other_folder_icon.9.png, it worked. So I think some names are used by the android system itself, maybe here is a problem too.

    0 讨论(0)
提交回复
热议问题