'app : mergeDebugResources'작업 실행 실패 크 런처 크 런처… png 실패
* .png 형식의 그림을 드로어 블 디렉토리에 추가하고 레이아웃과 연결했습니다. 하지만 빌드하려고 할 때마다 오류가 나타납니다.
"... Crunching Crunsher ... png 실패"
다음은 콘솔의 출력입니다.
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
나는 프로젝트를 정리하고, 다시 빌드하고, "gradlew clean build --refresh-dependencies"를 통해 종속성을 새로 고치려고했지만 아무것도 작동하지 않았습니다. build.gradle 파일에서 종속성을 확인했지만 오류가 발생하는 것 같습니다.
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'
}
아이디어가 있습니까? 오류의 원인은 무엇입니까? 파일 경로도 너무 길지 않고 매번 256 개의 기호로 인해 문제가되지 않습니다.
미리 감사드립니다 :)
제 경우에는 드로어 블 폴더에 추가 한 PNG 파일로 인해 오류가 발생했습니다. 텍스트를 부적절하게 변경 한 다음 PNG로 업로드 하여 확장자를 jpg 에서 png 로 변경했습니다.
이것이 Android Studio가 지적한 문제였습니다.
이 문제를 해결하고 Paint.NET 도구 또는 다른 도구 (올바른 방법)를 사용하여 파일 확장자를 변경 한 다음 드로어 블 폴더에 업로드 하여 오류가 사라지는 문제를 해결 했습니다.
프로젝트를 외부 디렉터리로 이동하여이 문제를 해결 한 다음 성공적으로 컴파일되었습니다.
프로젝트 디렉토리의 긴 경로 때문이었습니다.
예를 들어 다음에서 프로젝트를 이동했습니다.
D:/Android/Apps/AndroidStudioProject/AppName
에
D:/Android/AppName
이는 (.jpg)와 같은 일부 확장자가있는 드로어 블에 이미지를 추가하고이를 .png 형식으로 변경하거나 저장했기 때문입니다 (이 오류는 편집기 도구를 사용하지 않고 이미지 형식을 수동으로 변경하는 동안 발생합니다).
AAPT (Android Asset Packaging Tool)를 사용하여 리소스 패키지를 컴파일하는 동안 Android Studio에서 오류가 발생하므로 GIMP 또는 Paint 와 같은 일부 이미지 편집기 도구 를 사용하여 그에 따라 확장 프로그램을 저장하기 만하면됩니다. 모든 것이 완료되면 프로젝트를 다시 빌드하십시오.
예 : 그림판에서 이미지를 엽니 다 (이미지를 끌어서 놓아서 열 수 있음) → 메뉴 파일 → 다른 이름으로 저장 → 파일 형식 → 아래 그림과 같이 드롭 다운에서 필요한 형식을 선택합니다.
In my case the solution was simple. I moved the entire project to another location where the path is short.
The problem was caused by long directory names and file names.
The best solution is to change buildDir in build.gradle:
For example:
allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
repositories {
jcenter()
}
}
Rebuild and happy coding.
In my case, I solved this problem by simply changing my library file as I made a silly mistake of adding two different versions of the same library.
As this can be due to varied reasons, I found out the following ways to solve this issue as per the problem:
Mismatch of resources
Missing attributes, wrong tags, etc. in resources
Issue in styles
Missing name in styles
Duplicacy of resources and libraries
Sometimes it can even be solved by changing the compatible library in build.gradle
Executing the
aapt
commandRenaming the extension from .jpg to .png
Simply with the help of
Clean Project
.- Even in some cases, restarting Android Studio can solve the problem.
This is because your PNG file is not supported or else you renamed your file directly.
Do the following steps.
- Copy your image source file from Android Studio to your desktop.
- Open the file with Paint.
- Save file as extension .png
- Delete the existing source file from Android Studio which you copied.
- Add the newly created file which you renamed via Paint.
Problem solved :)
In my case, when I created a 9.png file, my original PNG file was using the margin where the 9.png line is drawn, creating a bad 9.png file. Try to add some margin to your PNG file.
If you're running Linux, try this:
sudo apt-get install lib32stdc++6 lib32z1
It is from here.
The best answer is already given in the gradle output:
* Try:
Run with --stacktrace option to get the stack trace.
Open the Terminal in Android Studio and run gradlew :app:mergeDebugResources --stacktrace
. (In my case it was the Windows 240 char limit), but it should give you the root cause for any other issue just as well.
In my case, I believe this issue was to do with the length of the file path. UNIX and Windows systems impose a maximum path length of 255 and 260 characters respectively, and I believe the crunch process fails when assigning to a dynamically-specified path. So, even if the quoted path lengths in the error message are shorter than the limit (mine was only 187 within a Windows build environment), I think the crunch utility may internally specify a longer path, even if just temporarily.
You may determine whether this is the source of error by moving your project to the root-most directory on your file system, then attempt recompiling.
I tried to rebuilt, restart, clean, update Gradle, etc. However, none of them worked for me.
Sometimes, it can be caused by a wrong naming for an XML or resource file.
At least, for me, that problem was solved by changing the name.
I noticed downgrading Gradle build tools to 1.2.3 solved my problem of the Crunching PNG error, but on 1.5.0 the problem continues.
File > Invalidate Caches / Restart
I had put my images into my drawable folder at the beginning of the project, and it would always give me this error and never build so I:
- Deleted everything from drawable
- Tried to run (which obviously caused another build error because it's missing a reference to files
- Re-added the images to the folder, re-built the project, ran it, and then it worked fine.
I have no idea why this worked for me, but it did. Good luck with this mess we call Android Studio.
The Crunching process is the image preparation process, which means something is wrong with your image files. In my case I had a PNG file which was not really a PNG file.
My solution:
I converted all my images to PNG running a super simple Python script from within the image folder, so in total all you need to do is:
- In order to install the PIL library, run:
pip install pillow
- Save the below Python code in a .py file within your images folder you want to convert.
- Adjust the from_format, to_format variables in the script to whatever you need.
Run script:
python script_name.py
import os from PIL import Image from_format = (".jpg", ".png", ".bmp") to_format = "png" for fn in os.listdir('.'): if os.path.isfile(fn) and fn.lower().endswith(from_format): print "Converting File: %s" % fn im = Image.open(fn) im.save(fn.split('.')[0] + '.' + to_format, to_format.upper())
And if you want read more about the Image module: http://effbot.org/imagingbook/image.htm
I faced this problem when I copied my images (no matter JPEG or PNG) into the drawable folder manually. There might be different kinds of temporary solutions to this problem, but one best eternal way is to use the Drawable importer plugin for Android studio.
Install it by going to: menu File → Settings → Plugins → Browse Repositories → search "Drawable". You'll find Drawable importer as the first option. Click install on the right panel.
Use it by right clicking on the Drawable resource folder and then new. Now you can see four new options added to the bottom of the list, and among those you will find your appropriate option. In this case the "Batch drawable import" would do the trick.
I got this issue after migration to Gradle 3.3, on Windows (with gradle-2.14.1 everything was fine).
The problem was in the path to the Gradle build-cache, which contains Cyrillic characters, like
C:\Users\Иван\.android\build-cache
So I renamed the user's folder to "Ivan", and the problem was gone.
It seems to be a nasty problem of Gradle. We just upgraded from 2.14 to 3.3 and our build server couldn't build any more (a local build in Android Studio worked).
Error with too long path shows for example:
C:\Windows\System32\config\systemprofile.gradle\caches\3.3\scripts-remapped\build_bonsjy48fqq8sotonpgrvhswt\36ejadunoxgw3iugkh95lqw\projedd7e29570ae79482d0308d82f4e346b\classes\build_bonsjy48fqq8sotonpgrvhswt$_run_closure1$_closure8$_closure13$_closure14$_closure15.class
We had to create a local user account for the service that ran as system service for years... Now it saves under C:\Users... which is much shorter as the system profile path.
I changed the location of the app and copied it to a short path. You can do that by just copying your project and pasting it to a new Short Location. And, it worked for me.
For example,
Old_path: c/:user/android_studio_project/your_app
New_path: c/:your_app
Closing Android Studio and opening again solved this issue in my case.
Give it a try. I know it is not the right solution or answer, but it works. I am not sure about the root cause. It would be great if someone can share that.
To solve this problem you should use drawable -> new -> image asset and then add your images. You will then find the mipmap folder contains your images, and you can use it by @mibmab/img.
I was importing an Android application in Android Studio (Gradle version 2.10) from Eclipse. The drawable images are not supported, then manually remove those images and paste some PNG images.
And also update the Android drawable importer from the Android repository. Then clean and rebuild the application, and then it works.
This error was caused for me because of the path where my project was located. There was a blank space in one folder, for example,
Folder\Another Folder\MyAndroidProjects\...
Changing it to Folder\AnotherFolder\MyAndroidProjects\...
and resynchronising Gradle resolved this for me.
I have faced this problem also, and it has not been solved by reformatting the image although it was an image from a project app of Google, and it was only solved by:
Moving the project file to the partition directly
Try it. It might help you.
In my case I reached the solution in two steps:
- Keep your project name, package name, folder names short, because if the directory name exceeds 255 characters it gives the mergeResource error.
- Keep your drawables in the drawable folders. Any drawable file such as .jpg and .png outside the drawable folders throws the mergeResource folder error.
I am also suffering from the same issue. In my case I just copied the image to the drawable folder, then Android Studio is showing the error "Some file crunching failed".
My problem regarding to image only because that image was saved from the one of the my customized camera application in .png format. And for testing purposes I copied it into the drawable folder.
After that I tested saving the image as .jpg. It was not giving any error. That means the camera by default supports the ".jpg" format.
Finally I realized two things:
The camera by default supports the ".jpg" format
Without using image tools, don't change the image formats (even programmatically).
Just add this to your local.properties file of your project:
BUILD_DIR=C\:\\Tmp
(The error in Windows is due a long path, so I gave the path to one temporary folder.)
For me, it is because one of my .png files is actually a .psd file. Resave it to real PNG file, and it is fixed.
저에게는 손상된 PNG 파일 이었습니다.
res
폴더로 이동하여 모든 이미지를 열어보십시오. 열 수없는 이미지를 찾으면 좋은 이미지로 교체하십시오.
'IT박스' 카테고리의 다른 글
C #에서 튜플 (또는 배열)을 사전 키로 사용 (0) | 2020.08.15 |
---|---|
moment.js 24h 형식 (0) | 2020.08.14 |
여러 태그 도커 이미지 만들기 (0) | 2020.08.14 |
webpack은 내부 또는 외부 명령, 작동 가능한 프로그램 또는 배치 파일로 인식되지 않습니다. (0) | 2020.08.14 |
ImportError : MySQLdb라는 모듈이 없습니다. (0) | 2020.08.14 |