Project error reporting - Some file crunching failed, see logs for details

Reference resources: Android Studio Error: Some files crunching failed, see logs for details

Project Error Reporting:

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

Reason:

This is the problem of 9-patch image resource file.

Solution:

Click on Gradle Console in the lower right corner to view the detailed gradle log, such as my project:

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

Configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to D:\Users\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

useNewCruncher has been deprecated. It will be removed in a future version of the gradle plugin. New cruncher is now always enabled.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:app:prepareComAndroidSupportAppcompatV72531Library
:app:prepareComAndroidSupportConstraintConstraintLayout102Library
:app:prepareComAndroidSupportSupportCompat2531Library
:app:prepareComAndroidSupportSupportCoreUi2531Library
:app:prepareComAndroidSupportSupportCoreUtils2531Library
:app:prepareComAndroidSupportSupportFragment2531Library
:app:prepareComAndroidSupportSupportMediaCompat2531Library
:app:prepareComAndroidSupportSupportV42531Library
:app:prepareComAndroidSupportSupportVectorDrawable2531Library
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources

AAPT err(Facade for 1520024021): 
ERROR: 9-patch image \\?\D:\Users\Administrator\AndroidStudioProjects\Njb\app\src\main\res\drawable-xhdpi\iv_log_et_bg.9.png malformed.
AAPT err(Facade for 147729603): 
ERROR: 9-patch image \\?\D:\Users\Administrator\AndroidStudioProjects\Njb\app\src\main\res\drawable-xhdpi\commentlist.9.png malformed.
AAPT err(Facade for 1423460849): 
ERROR: 9-patch image \\?\D:\Users\Administrator\AndroidStudioProjects\Njb\app\src\main\res\drawable-mdpi\navbar.9.png malformed.
AAPT err(Facade for 1520024021):        Frame pixels must be either solid or transparent (not intermediate alphas).
AAPT err(Facade for 1423460849):        Must have one-pixel frame that is either transparent or white.
AAPT err(Facade for 147729603):        Frame pixels must be either solid or transparent (not intermediate alphas).
AAPT err(Facade for 1520024021):        Found at pixel #1 along bottom edge.
AAPT err(Facade for 147729603):        Found at pixel #565 along top edge.
AAPT err(Facade for 147729603): 
ERROR: 9-patch image \\?\D:\Users\Administrator\AndroidStudioProjects\Njb\app\src\main\res\drawable-xhdpi\supply_demand_add.9.png malformed.
AAPT err(Facade for 147729603):        Frame pixels must be either solid or transparent (not intermediate alphas).
AAPT err(Facade for 147729603):        Found at pixel #70 along top edge.

Error: Some file crunching failed, see logs for details
:app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

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

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 23.603 secs

First look at the English meaning:

malformed: deformity

facade: surface

Frame pixels must be either solid or transparent (not intermediate alphas).
Border pixels must be solid or transparent (not intermediate transparency)

Must have one-pixel frame that is either transparent or white.
There must be a transparent or white pixel border.

In the error log above, we know which 9-patch pictures are problematic, and then find them one by one. The operation is as follows:

Hold down Ctrl or shift and click the left mouse button to adjust the black part on the boundary pixels until we need the area without reporting errors.

When it's finished, sync and clean.

Tags: Attribute 9-patch Android Gradle

Posted on Fri, 08 Feb 2019 07:54:16 -0500 by nesargha