A failure occurred while executing com.android.build.gradle.tasks.MergeResources解决方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A failure occurred while executing com.android.build.gradle.tasks.MergeResources解决方法相关的知识,希望对你有一定的参考价值。
参考技术A 从git上git下来的项目,之前用其他电脑都没有问题,各种查阅网上资料说是9.png的问题,于是在gradle.build里加了跳过检查错误9.png的错误。然而并无多大用处,还是报了一样的错误。又经过一轮的百度,看到了一篇文章
https://blog.csdn.net/runner__1/article/details/53482565
然后我也用了gradlew compileDebugSources --stacktrace -info 命令试了一下,看到gradle console里提示AAPTerr: No Delegate set : lost message:\\?\C:\...\build-cache\...\*.png ERROR: Unable to open PNG f
然后百度找到了这篇文章
https://blog.csdn.net/zhangping2015/article/details/71338266
大概就是说问题出现在2.3 android studio默认是缓存图片的,而我的3.0是直接从2.3升过来的(估计是遗留的问题),因此我在gradle.properties中添加了android.enableBuildCache=false 即可!
真是尴尬,这绝对是android studio的bug
Unity打包报错A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFa
最近预见一个奇葩事,明明前几天的版本打包安卓正常的,也正常打包出apk了,然后改了点东西突然就不行了,通过版本控制svn还原到之前能正常打包的版本,也报一样的错误,真是活见鬼了。
报错信息如下:
* What went wrong:
Execution failed for task ':launcher:packageRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> value (4304957338) > 0x00000000ffffffffL
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':launcher:packageRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> value (4304957338) > 0x00000000ffffffffL
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 31s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Configure project :launcher
WARNING: The option 'android.enableR8' is deprecated and should not be used anymore.
It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:unity-android-resources:preBuild UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:unity-android-resources:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:unity-android-resources:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:unity-android-resources:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:unity-android-resources:compileReleaseRenderscript NO-SOURCE
> Task :launcher:generateReleaseBuildConfig
> Task :unityLibrary:unity-android-resources:generateReleaseResValues
> Task :unityLibrary:generateReleaseBuildConfig
> Task :unityLibrary:unity-android-resources:generateReleaseResources
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues
> Task :unityLibrary:generateReleaseResources
> Task :launcher:mainApkListPersistenceRelease
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:generateReleaseResValues
> Task :launcher:generateReleaseResources
> Task :launcher:createReleaseCompatibleScreenManifests
> Task :launcher:extractDeepLinksRelease
> Task :launcher:prepareLintJar
> Task :launcher:checkReleaseDuplicateClasses
> Task :unityLibrary:unity-android-resources:packageReleaseResources
> Task :unityLibrary:packageReleaseResources
> Task :unityLibrary:extractDeepLinksRelease
> Task :unityLibrary:unity-android-resources:generateReleaseBuildConfig
> Task :unityLibrary:unity-android-resources:extractDeepLinksRelease
> Task :unityLibrary:unity-android-resources:parseReleaseLocalResources
> Task :unityLibrary:mergeReleaseShaders
> Task :unityLibrary:compileReleaseShaders
> Task :unityLibrary:generateReleaseAssets
> Task :unityLibrary:unity-android-resources:mergeReleaseShaders
> Task :unityLibrary:unity-android-resources:compileReleaseShaders
> Task :unityLibrary:unity-android-resources:generateReleaseAssets
> Task :unityLibrary:unity-android-resources:packageReleaseAssets
> Task :unityLibrary:unity-android-resources:processReleaseJavaRes NO-SOURCE
> Task :launcher:mergeReleaseShaders
> Task :launcher:compileReleaseShaders
> Task :launcher:generateReleaseAssets
> Task :launcher:processReleaseJavaRes NO-SOURCE
> Task :unityLibrary:unity-android-resources:processReleaseManifest
> Task :launcher:mergeReleaseJniLibFolders
> Task :launcher:validateSigningRelease
> Task :unityLibrary:unity-android-resources:mergeReleaseJniLibFolders
> Task :unityLibrary:unity-android-resources:prepareLintJarForPublish
> Task :unityLibrary:unity-android-resources:bundleLibResRelease
> Task :unityLibrary:unity-android-resources:javaPreCompileRelease
> Task :unityLibrary:unity-android-resources:generateReleaseRFile
> Task :unityLibrary:unity-android-resources:compileReleaseJavaWithJavac
> Task :unityLibrary:unity-android-resources:mergeReleaseNativeLibs
> Task :unityLibrary:unity-android-resources:stripReleaseDebugSymbols
> Task :unityLibrary:unity-android-resources:copyReleaseJniLibsProjectOnly
> Task :unityLibrary:unity-android-resources:bundleLibRuntimeRelease
> Task :unityLibrary:unity-android-resources:bundleLibCompileRelease
> Task :launcher:mergeReleaseResources
> Task :launcher:desugarReleaseFileDependencies
> Task :unityLibrary:unity-android-resources:compileReleaseLibraryResources
> Task :launcher:mergeExtDexRelease
> Task :unityLibrary:parseReleaseLocalResources
> Task :unityLibrary:processReleaseManifest
> Task :unityLibrary:compileReleaseLibraryResources
> Task :unityLibrary:prepareLintJarForPublish
> Task :unityLibrary:packageReleaseAssets
> Task :unityLibrary:processReleaseJavaRes NO-SOURCE
> Task :unityLibrary:mergeReleaseJniLibFolders
> Task :unityLibrary:javaPreCompileRelease
> Task :unityLibrary:bundleLibResRelease
> Task :unityLibrary:generateReleaseRFile
> Task :unityLibrary:compileReleaseJavaWithJavac
> Task :unityLibrary:bundleLibRuntimeRelease
> Task :unityLibrary:bundleLibCompileRelease
> Task :unityLibrary:mergeReleaseNativeLibs
> Task :unityLibrary:stripReleaseDebugSymbols
> Task :unityLibrary:copyReleaseJniLibsProjectOnly
> Task :launcher:mergeReleaseAssets
> Task :launcher:processReleaseManifest
> Task :launcher:processReleaseResources
> Task :launcher:javaPreCompileRelease
> Task :launcher:compileReleaseJavaWithJavac
> Task :launcher:compileReleaseSources
> Task :launcher:lintVitalRelease
WARNING: The targetSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
WARNING: The targetSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
> Task :launcher:dexBuilderRelease
> Task :launcher:mergeReleaseNativeLibs
> Task :launcher:stripReleaseDebugSymbols
> Task :launcher:mergeDexRelease
> Task :launcher:mergeReleaseJavaResource
> Task :launcher:packageRelease
> Task :launcher:packageRelease FAILED
68 actionable tasks: 68 executed
]
exit code: 1
于是去谷歌搜索了下,也没找到跟这一模一样的错误信息,尝试着改了gradle.properties改了gradle版本从3.6.3改成3.4.0,报错改了,变成了
Execution failed for task ':launcher:packageRelease'.
> 1 exception was raised by workers:
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: value (4295634145) > 0x00000000ffffffffL
然后再尝试着打开multiDexEnable,发现也是不行。
multiDexEnabled true
将IL2CPP取消掉也不行,加上keystore签名也不行(之前成功的没有加)
导出Android工程出包,也是一样报错。。。这事情太诡异了。
自从Unity从2019版本开始将安卓打包系统Internal System移除,只能通过Gradle打包,这点真的太不方便了,Gradle打包总是莫名其妙各种打包问题。
之前碰到过,通过还原ProjectSetting修好了(之前打包不知道为什么会自动修改ProjectSetting),但是这次又不行了,实在是不知道什么原因。
如果有朋友知道怎么解决的,欢迎评论告诉我,感谢。
-----------------------------------------------------------------------------
更新:2021.12.5
经过测试,删除StreamingAssets下的.mp3、.mp4素材,可以正常打包。说明应该是StreamingAssets某些文件扩展名不支持,会导致报错,具体看这个链接提到的unity bug。
------------------------------------------------------------------------------
更新:20220311
今天又开始报错了,删了一些文件还是报错,最后继续删才能打包,猜测很大的可能是因为包体超过了4G。似乎apk超过4G打包会报错。
Bug: 4GB limit to Textures in standalone build - Unity Forum
-----------------------------------------------------------------------------
【Unity】打包报错 com.android.buil.gradle.internal.tasks.workers$ActionFacade
unity3d - How to fix error "A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade" after installing Photon in Unity - Stack Overflowunity3d - How to fix in Unity "A failure occurred while executing com.android.build.gradle.internal.tasks.workers$actionfacade" - Stack Overflow
以上是关于A failure occurred while executing com.android.build.gradle.tasks.MergeResources解决方法的主要内容,如果未能解决你的问题,请参考以下文章
Execution failed for task ‘:app:processDebugResources‘. > A failure occurred while executing com.and
A failure occurred while executing com.android.build.gradle.tasks.MergeResources解决方法
Unity打包报错A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFa
错误记录Android Studio 编译报错 ( Execution failed for task ‘:app:kaptDebugKotlin‘. A failure occurred w )
错误记录Android Studio 编译报错 ( Execution failed for task ‘:app:kaptDebugKotlin‘. A failure occurred w )
[问题] An error occurred while automatically activating bundle com.android.ide.eclipse.adt