导入模块库后出现Gradle错误

时间:2017-08-14 10:27:05

标签: java android-studio gradle module

以下是我从错误消息中获得的内容:

  

信息:Gradle任务[clean,:app:generateDebugSources,:app:generateDebugAndroidTestSources,:app:mockableAndroidJar,:app:prepareDebugUnitTestDependencies,:library:generateDebugSources,:library:generateDebugAndroidTestSources,:library:mockableAndroidJar,:library:prepareDebugUnitTestDependencies]       错误:某些文件崩溃失败,请参阅日志以获取详细信息       错误:任务':app:mergeDebugResources'的执行失败。>错误:某些文件崩溃失败,请参阅日志以获取详细信息       信息:建筑失败       信息:总时间:3.008秒       信息:2个错误       信息:0警告       信息:请参阅控制台中的完整输出

消息:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.>
Error: 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

Total time: 3.212 secs
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :library:generateDebugSources, :library:generateDebugAndroidTestSources, :library:mockableAndroidJar, :library:prepareDebugUnitTestDependencies]

Parallel execution with configuration on demand is an incubating feature.
Using the 'clean' task in combination with parallel execution may lead to unexpected runtime behavior.
Incremental java compilation is an incubating feature.
:clean
:app:clean
:library:clean
:library:preBuild UP-TO-DATE
:library:preReleaseBuild UP-TO-DATE
:library:checkReleaseManifest
:library:preDebugAndroidTestBuild UP-TO-DATE
:library:preDebugBuild UP-TO-DATE
:library:preDebugUnitTestBuild UP-TO-DATE
:library:preReleaseUnitTestBuild UP-TO-DATE
:library:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:library:prepareComAndroidSupportAppcompatV72531Library
:library:prepareComAndroidSupportSupportCompat2531Library
:library:prepareComAndroidSupportSupportCoreUi2531Library
:library:prepareComAndroidSupportSupportCoreUtils2531Library
:library:prepareComAndroidSupportSupportFragment2531Library
:library:prepareComAndroidSupportSupportMediaCompat2531Library
:library:prepareComAndroidSupportSupportV42531Library
:library:prepareComAndroidSupportSupportVectorDrawable2531Library
:library:prepareReleaseDependencies
:library:compileReleaseAidl
:library:compileLint
:library:copyReleaseLint UP-TO-DATE
:library:mergeReleaseShaders
:library:compileReleaseShaders
:library:generateReleaseAssets
:library:mergeReleaseAssets
:library:mergeReleaseProguardFiles UP-TO-DATE
:library:packageReleaseRenderscript UP-TO-DATE
:library:compileReleaseRenderscript
:library:generateReleaseResValues
:library:generateReleaseResources
:library:packageReleaseResources
:library:processReleaseManifest
:library:bundleRelease
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:app:prepareComAndroidSupportAppcompatV72531Library
:library:checkDebugManifest
:app:prepareComAndroidSupportConstraintConstraintLayout101Library
:library:prepareDebugDependencies
:library:compileDebugAidl
:app:prepareComAndroidSupportDesign2531Library
:app:prepareComAndroidSupportRecyclerviewV72531Library
:app:prepareComAndroidSupportSupportCompat2531Library
:library:compileDebugRenderscript
:app:prepareComAndroidSupportSupportCoreUi2531Library
:app:prepareComAndroidSupportSupportCoreUtils2531Library
:app:prepareComAndroidSupportSupportFragment2531Library
:app:prepareComAndroidSupportSupportMediaCompat2531Library
:library:generateDebugBuildConfig
:app:prepareComAndroidSupportSupportV42531Library
:app:prepareComAndroidSupportSupportVectorDrawable2531Library
:library:generateDebugResValues
:app:prepareComAndroidSupportTransition2531Library
:library:generateDebugResources
:library:mergeDebugResources
:app:prepareComJakewhartonButterknife881Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
AAPT: libpng error: Not a PNG file
:library:processDebugManifest
:library:processDebugResources
Error: Some file crunching failed, see logs for details
:app:mergeDebugResources FAILED

如何解决?

2 个答案:

答案 0 :(得分:0)

您应该在gradle.properties中发表评论org.gradle.parallel = true

答案 1 :(得分:0)

检查捆绑的可绘制资源/图像。其中一个或少数可能不是正确的.png文件

  

AAPT:libpng错误:不是PNG文件

解决方案在编辑器中打开不正确的文件,并使用相同的名称和正确的.png扩展名保存。