android - 任务 'app:mergeDebugResources' Crunching C

我已将一些格式为 *.png 的图片添加到我的可绘制目录中,并将其与布局相关联。但是每次我尝试构建它时,都会出现错误

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

以下是控制台的输出:

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 文件引起的。我通过更改文本(以不正确的方式)将其扩展名从 jpg 更改为 png,然后将其上传为 PNG。

这就是 Android Studio 所指出的问题。

我解决了这个问题,并通过使用 Paint.NET 更改文件扩展名使错误消失工具或任何其他工具(正确方式),然后将其上传到可绘制文件夹。

关于android - 任务 'app:mergeDebugResources' Crunching Cruncher 执行失败....png 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30764604/

相关文章:

xcode - iOS5 Storyboard错误 : Storyboards are unavai

c# - 调试未启动

build - 使用 msbuild 指定解决方案的项目文件

xcode4 - Xcode 4 在哪里存储方案数据?

.net - NuGet 自动包还原不适用于 MSBuild

eclipse - 在解决构建路径错误之前,无法构建项目。

visual-studio - Visual Studio 2015 项目构建失败但没有错误

git - sbt 如何从 git 中提取依赖项?

.net - 如何识别 DLL 是 Debug 还是 Release 构建(在 .NET 中)

maven - Javascript Web 应用程序和 Java 服务器,全部在 Maven 中构