app:mergeDebugResources error in Android Studio after upgrade

lang_android picture lang_android · Nov 20, 2015 · Viewed 26.8k times · Source

I am getting a error on build/execution of the Android Studio project.

Error:

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

Some file crunching failed, see logs for details

I have gone through the post on SO and have done the following things to fix it, but I am still not able to get rid of the errors.

  1. Clean Project.

  2. Invalidate and Restart Android Studio.

  3. I have upgraded the Gradle Version from 1.3.0 to 1.5.0.

  4. I have also upgraded the buildToolsVersion '23.0.1'.

Few more Gradle traces for reference:

Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources] :app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72300Library :app:prepareComAndroidSupportDesign2300Library :app:prepareComAndroidSupportSupportV42300Library :app:prepareComCrashlyticsSdkAndroidAnswers131Library :app:prepareComCrashlyticsSdkAndroidBeta113Library :app:prepareComCrashlyticsSdkAndroidCrashlytics251Library :app:prepareComCrashlyticsSdkAndroidCrashlyticsCore234Library :app:prepareComGithubClansFab155Library :app:prepareComGithubPaolorotoloAppintro320Library :app:prepareComGoogleAndroidGmsPlayServicesBase780Library :app:prepareComGoogleAndroidGmsPlayServicesGcm780Library :app:prepareIoFabricSdkAndroidFabric135Library :app:prepareJpWasabeefBlurry101Library :app:prepareDebugDependencies :app:compileDebugAidl :app:compileDebugRenderscript :app:generateDebugBuildConfig :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets :app:generateDebugResValues UP-TO-DATE :app:processDebugGoogleServices :app:generateDebugResources :app:mergeDebugResources

AAPT: ERROR: 9-patch image /Users/v/app/src/main/res/drawable-xxxhdpi/btn_small_white_normal.9.png malformed. AAPT: Found at pixel #21 along top edge. AAPT: /Users/v/Documents/app/src/main/res/drawable-mdpi/ic_send_black_disabled_24dp.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:mergeDebugResources'.

    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

Answer

lang_android picture lang_android · Nov 20, 2015

I found the solution to this problem, it might be a temporary fix but it works for now. This problem is generated because of problem with the 9 patch image.

Look at this line in the traces, its throwing error.

AAPT: ERROR: 9-patch image /Users/v/app/src/main/res/drawable-xxxhdpi/btn_small_white_normal.9.png malformed. AAPT: Found at pixel #21 along top edge.

I have fixed the error by renaming the asset and removing the .9 from the file name. The 9 patch file is a malformed asset and Android Studio will not build until its fixed.

You can ask you designer to fix it for you.