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.
Clean Project.
Invalidate and Restart Android Studio.
I have upgraded the Gradle Version from 1.3.0 to 1.5.0.
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
Studio doesn't start after upgrade If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin.
You may experience "Recording failed to stop" errors in the Android Studio CPU Profiler when you select the Sample Java Methods or Trace Java Methods configurations. These are often timeout errors, especially if you see the following error message in the idea.log file:
Starting in Gradle 7.0, file watching is enabled by default. If you are working on Mac OS and your project is saved under /System/Volumes/Data, Gradle file watching will not properly track file changes. This will cause the Build System to not see any file changes and it will therefore not update the APK (s).
Warning: Android resource linking failed,error: failed linking references。 In the above figure, you will find that the compile sdk version and the build tools version are not the same, so change the build tools version to 26. Run again successfully.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With