Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execution failed for task 'app:mergeDebugResources' Crunching Cruncher....png failed

I've added some pictures with the format *.png to my drawable-directory and linked it with the layouts. But every time when I tried to build it, there appears an error

"...Crunching Crunsher ...png failed"

Following is the output of the console:

app:mergeDebugResources
AAPT out(1561599) : No Delegate set : lost message:Done
AAPT out(12956469) : No Delegate set : lost message:Done
AAPT out(20612543) : No Delegate set : lost message:Crunching             C:\Dev\StudioProjects\test\android\app\src\main\res\drawable\bt_meeting_focused.png
AAPT out(11030156) : No Delegate set : lost message:Crunching     C:\Dev\StudioProjects\test\android\app\src\main\res\mipmap-mdpi\ic_launcher.png
AAPT out(11030156) : No Delegate set : lost message:Crunching single PNG file: C:\Dev\StudioProjects\test\android\app\src\main\res\mipmap-    mdpi\ic_launcher.png
AAPT out(11030156) : No Delegate set : lost message:    Output file:     C:\Dev\StudioProjects\test\android\app\build\intermediates\res\debug\mipmap-mdpi-v4\ic_launcher.png
AAPT out(11030156) : No Delegate set : lost message:Done
AAPT err(11030156): libpng error: Not a PNG file
AAPT out(20612543) : No Delegate set : lost message:Crunching single PNG     file:     C:\Dev\StudioProjects\test\android\app\src\main\res\drawable\bt_meeting_focused.png
AAPT out(20612543) : No Delegate set : lost message:    Output file:     C:\Dev\StudioProjects\test\android\app\build\intermediates\res\debug\drawable\b    t_meeting_focused.png
AAPT out(20612543) : No Delegate set : lost message:Done
AAPT err(20612543): libpng error: Not a PNG file
AAPT err(1561599): libpng error: Not a PNG file
AAPT err(12956469): libpng error: Not a PNG file

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Crunching Cruncher uhr.png failed, see logs

* 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: 14.598 secs
Executing tasks: [clean, :app:generateDebugSources,     :app:generateDebugAndroidTestSources]

Configuration on demand is an incubating feature.
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
AAPT out(14080484) : No Delegate set : lost message:Done
AAPT out(9206750) : No Delegate set : lost message:Done
AAPT out(25360025) : No Delegate set : lost message:Done
AAPT err(25360025): libpng error: Not a PNG file
AAPT err(14080484): libpng error: Not a PNG file
AAPT out(6423170) : No Delegate set : lost message:Crunching C:\Dev\StudioProjects\test\android\app\src\main\res\drawable\anfrage_senden_.png
AAPT err(6423170): libpng error: Not a PNG file
AAPT out(6423170) : No Delegate set : lost message:Crunching single PNG file:     C:\Dev\StudioProjects\test\android\app\src\main\res\drawable\anfrage_senden_.png
AAPT out(6423170) : No Delegate set : lost message: Output file: C:\Dev\StudioProjects\test\android\app\build\intermediates\res\debug\drawable\a    nfrage_senden_.png
AAPT out(6423170) : No Delegate set : lost message:Done
AAPT err(9206750): libpng error: Not a PNG file

Process list not empty
:app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Crunching Cruncher uhr.png failed, see logs

* 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: 4.325 secs

I tried to clean the project, rebuild it, refresh the dependencies via "gradlew clean build --refresh-dependencies", nothing worked. I've checked the dependencies in the build.gradle file but nothing seems creating the error.

   apply plugin: 'com.android.application'
   android {
   compileSdkVersion 22
   buildToolsVersion "22.0.1"
   compileOptions.encoding = 'windows-1251'

   defaultConfig {
       applicationId "com.example.benutzer.test"
       minSdkVersion 16
       targetSdkVersion 22
       versionCode 1
       versionName "1.0"
   }
   buildTypes {
    release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'),    'proguard-rules.pro'
       }
   }
   }

   dependencies {
   compile 'com.android.support:support-v4:22.2.0'
  }

Do you've got an idea, what's the source of the error? The filepath is also not too long and everytime unter 256 signs, that also not the problem :/

Thank you in advance :)

like image 326
bot.rubiks Avatar asked Jun 10 '15 18:06

bot.rubiks


3 Answers

In my case, the error was caused by a PNG file I added to the drawable folder. I had changed its extension from jpg to png by changing the text (in an inproper way) and then uploading it as PNG.

This was the problem Android Studio was pointing to.

I fixed this problem and got the error to disappear by changing the file extension using the Paint.NET tool or any other tool (proper way), and then uploading it to the drawable folder.

like image 151
smoothumut Avatar answered Nov 09 '22 19:11

smoothumut


I fixed this issue by moving the project to the outer directory, and it then compiled successfully.

It was due to the long path of the project directory.

For example, I moved the project from:

D:/Android/Apps/AndroidStudioProject/AppName

to

D:/Android/AppName
like image 116
Lakhan Sharma Avatar answered Nov 09 '22 18:11

Lakhan Sharma


This is due to adding an image in drawable which has some extension like (.jpg), and you have changed or saved that to a .png format (this error will occur while changing the image format manually without using an editor tool).

Android Studio will throws an error while compiling the resource package using AAPT (Android Asset Packaging Tool), so all you need to do is use some image editor tools like GIMP or Paint to save the extension accordingly. Rebuild your project once everything is done.

For example: open your image in Paint (drag and drop your image to open it) → menu FileSave AsSave as Type → select your required type from the dropdown like I have shown in the below pictures:

Enter image description here

Enter image description here

like image 53
anand krish Avatar answered Nov 09 '22 19:11

anand krish