[游戏开发][Unity]安卓出包报错记录

 打包报错日志有以下几种类型:

报错:

CommandInvokationFailure: Android Asset Packaging Tool failed.
E:\Android-SDK-Tool\build-tools\33.0.2\aapt.exe package -v -f -F raw.ap_ -A raw -0 "" --ignore-assets "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"

多个原因都会导致这个报错,虽然前缀一样,但后续的Log就很清楚显示原因

后续1:

stderr[
raw\audioclips\cv\��������.unity3d: error: Invalid filename.  Unable to add.
]
stdout[
Found 5269 custom asset files in raw
]

原因:

StreamingAssets子文件夹名字含中文

解决办法:中文文件改英文名。

后续2:

stderr[
      Unable to add 'raw\prefabs\bb_spine\s_yzq11.unity3d': Zip add failed (-2147483648)
ERROR: unable to process assets while packaging 'raw.ap_'
ERROR: packaging of 'raw.ap_' failed
]
stdout[
Found 5274 custom asset files in raw
Configurations:
 (default)

后面罗列了文件列表

原因:

1、StreamingAssets内的文件数量过多,具体过多的数量极限是多少目前还不清楚。

解决方法:

想办法把资源合并一下,比如图打成图集

2、StreamingAssets文件夹过大,导致包体超过2G

解决方法:

经过测试,StreamingAssets文件夹1.92GB,出包大小1.98GB,所以理论上StreamingAssets文件夹的最大限制为1.94GB以内,出的APK包大小正好是2G以内。

报错:

CommandInvokationFailure: Failed to align APK.
E:\Android-SDK-Tool\build-tools\33.0.2\zipalign.exe 4 "D:\TopmasterSingle\Client\project\Temp/StagingArea\Package_unaligned.apk" "D:\TopmasterSingle\Client\project\Temp/StagingArea\Package.apk"

原因:

安卓包体超2G

猜你喜欢

转载自blog.csdn.net/liuyongjie1992/article/details/133682969