解决安卓:Execution failed for task ‘:processDebugResources‘. / Unknown chunk type ‘200‘. / AAPT2 aapt2-

AndroidStudio4.12 & AndroidStudio2022.3+

Unity2018.4.36

Execution failed for task ':processDebugResources'.

 java.lang.ArrayIndexOutOfBoundsException: 1866
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
     This should not happen under normal circumstances, please file an issue if it does.

Execution failed for task ':processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
     This should not happen under normal circumstances, please file an issue if it does.


AAPT2 process unexpectedly exit. Error output:
aapt2.exe W 04-07 17:07:32  2044 13796 LoadedArsc.cpp:657] Unknown chunk type '200'.

 解决方法(1):讲将build.gradle中此处多余的文件删除

如:

aaptOptions {
    noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] //去掉这里 + unityStreamingAssets.tokenize(', ')
    ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}

解决方法(2):
2.1
Build Setting–>Publishing Setting–>Build --Custom Gradle Template勾选上,

这时候会自动生成Plugins/Android下mainTemplate,打开这个文件
2.2
修改mainTemplate: 去掉 '**STREAMING_ASSETS** 或者 特地某个类型不压缩如.bundle后缀的文件 如果不填 默认压缩

原因:
(1)aaptOptions.noCompress数组的最大容量为255,也即可以不经压缩打到apk包里的资源文件数不能超过255个。也可以将多余的 STREAMING_ASSETS (含义为StreamingAssets文件夹下所有资源都不压缩)去掉,改为只针对某些类型的资源不压缩,比如.bundle
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
                        
原文链接:https://blog.csdn.net/js0907/article/details/105641070

  • 15
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AD_喵了个咪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值