Some file crunching failed, see logs for details

六眼飞鱼酱① 提交于 2019-11-26 16:26:13

问题


Today I got update for android studio 2.0 in stable version.

I update it and it restarted.

Then when It opens my existing project, it ask me to update my gradle plugin to 2.0 to get advantages of "instant run" and other features to my current project of android studio 2.0

So I update it and it sets to

classpath 'com.android.tools.build:gradle:2.0.0'

but when I clean the project it gives me below error

AAPT err(Facade for 1961798984): libpng error: Read Error.

Error:Execution failed for task ':app:mergeDebugResources'.

Some file crunching failed, see logs for details

I tried to fixed it many times but it didn't solve.

Can anyone know what is the reason for this error ?


回答1:


You can try to add this to your app build.gradle file

 android {
    aaptOptions {  
                cruncherEnabled = false  
            } 
        }



回答2:


I ran into this problem in the past and did just back the version down. Today when I upgraded to AS 2.0, I got the same problem with the images. I did have to hunt down the offending images (there were 2 in my case) and had my designer re-export them.

Here's how I diagnosed (I'm on a mac FYI):

./gradlew :app:mergeIntegrationDebugResources --debug > buildLog.txt

Once that finished, I opened up the buildLog.txt file, and searched for "Error" (no quotes in actual search). I saw which file was having problems, and then removed it from the appropriate folder, and then re-ran the command above until I didn't get any errors.

I then sent the files that were having problems to my designer and had them re-exported.

Hope this helps!




回答3:


I've ran into this issue a couple times. The issue I've found is that an asset is either corrupted or has the wrong file extension. In my case it's usually a corrupted image I'd get from the art department. Once I removed the offending file, everything would compile and run just fine.

Basically what's happening is that Android is trying to compress and format the assets and resources, but if one of them is corrupted then it fails.

So try removing any recently added assets or resources.




回答4:


aaptOptions {
        cruncherEnabled = false
}

Add the above line to your application module build.gradle

Clear the build cache Similar to the Android plugin's clean task that clears your project’s build/ directories, you can run the cleanBuildCache task to clear your project’s build cache. If a project specifies a non-default directory for its build cache, running the task from that project clears only that cache (and not the shared cache in the default location). To execute the task, select View > Tool Windows > Terminal from the menu bar and use one of the following commands:

On Windows:

gradlew cleanBuildCache

On Mac or Linux:

./gradlew cleanBuildCache



回答5:


in my case it was a png with size 0 in one of the folders.




回答6:


i had the same issue.

in my case it happends after i added 9-patch file to the project.

Problem: one of the patches arount the image is missing.

Fix: double click on the 9-patch file. make sure you set the patches in all sides (up,down,right,left).

in my case this was the only solution after i tried many things




回答7:


Please add the below code inside android {} in build.gradle (Module:app)

aaptOptions {  
                cruncherEnabled = false  
            } 

PFA screenshotApp Gradle Build




回答8:


do not change file extension while pasting into the drawable folder... Some error may occur due to that change (ex: logo.PNG to logo.png )... to avoid this kind of problem you should edit extension before pasting into the drawable.




回答9:


I use this code.Its working for me perfectly.

android {
aaptOptions {  
            cruncherEnabled = false  
            } 
   }



回答10:


simple answer works for sure....

just add below code in the build.gradle(Module:app) of your project:

android {
    aaptOptions {
        cruncherEnabled = false
    }
}

example:

Works 100%...@Ambilpur




回答11:


This problem is caused generally by errors inside the resources files,

Some file crunching failed, see logs for details

most of the times we only see this message all the time, but to have a better diagnostic, delete the folders /build and his contain in your proyect, then the real problemas will show:




回答12:


Lower down the gradle version in build.graddle file to 1.3.0

 dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
 }


来源:https://stackoverflow.com/questions/36495978/some-file-crunching-failed-see-logs-for-details

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!