Some file crashing failed, see logs for details

Reference: Android studio error Error:Some file 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 a problem with the 9-patch image resource file

resolvent:

1. Modify the 9-patch image:

Click gradle console in the lower right corner to view the detailed log of gradle, 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: malformed

Facade: surface

Frame pixels must be either solid or transparent (not intermediate alpha).
frame pixels must be solid or transparent

Must have one pixel frame that is either transparent or white.
must have a transparent or white pixel frame.

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

Hold down Ctrl or shift, click the left mouse button, and adjust the black part on the boundary pixel until we need the area and do not report an error.

After the completion of sync, clean it.

2. Add 9-patch ignore:

If there are any problems, please click build.gradle Add Android studio and ignore the check of 9-patch

    aaptOptions {
        cruncherEnabled = false
        useNewCruncher = false
    }

As follows:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.3'

    aaptOptions {
        cruncherEnabled = false
        useNewCruncher = false
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/ASL2.0'
    }

    defaultConfig {
        applicationId "com.example.administrator.njb"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

Read More: