在过去的6天里,我一直在努力让Unity来制作我的Android游戏。
我的游戏在几个月前就应该这样构建,我想出了一些新东西并添加了它们(游戏邦注:游戏在Unity中运行良好,在游戏模式中没有错误)。
尝试用c++编译器设置为"master"来构建我的游戏,然而,始终失败,有以下例外:
1。
Building LibraryBeeartifactsAndroidfy9m9libil2cpp.so failed with output:
C:/Program Files/Unity/Hub/Editor/2021.3.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/binld.gold.exe: internal error in arm_branch_common, at /buildbot/src/android/binutils/toolchain/binutils/binutils-2.27/gold/arm.cc:4063
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
- 使用c++编译器配置设置为'release'时也会编译
- 如果我将平台切换到Windows ,我可以构建项目
- 如果我将编译器设置为"调试"而不是"主",似乎项目可以构建,这并不能解决问题,但可能是实际问题的线索(?)
- 确保它不是由我添加的东西引起的:我加载了我的游戏的备份(版本1.0,工作良好,也已发布),但备份也不能再构建。
- 确保问题不是Unity本身,我试图做一个干净的项目构建。
- 我更新了我项目中的所有包
- 我更新了Unity版本,我的项目使用2021.3.14f1(我也使用另一个Android项目,可以用该版本构建)。
- 更新了Google Play Games for Unity Plugin (https://github.com/playgameservices/play-games-plugin-for-unity)和所需的随附代码更改
- 根据Reddit上的响应,我确保没有脚本使用UnityEditor命名空间(少数这样做的,用#IF UNITY_EDITOR命令
BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <6a5b55f2e18b419e9faedac06ac6af94>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <6a5b55f2e18b419e9faedac06ac6af94>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <b5a1f7b6d39d4ca78ca284153b2ea92d>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <6a5b55f2e18b419e9faedac06ac6af94>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Build completed with a result of 'Failed' in 668 seconds (667590 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
4UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <6a5b55f2e18b419e9faedac06ac6af94>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <6a5b55f2e18b419e9faedac06ac6af94>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
我已经尝试过的事情:
感谢用户jdweng,我从不同的角度找到了问题。这让我看到了Unity论坛上的一个帖子,有人有和我描述的完全相同的问题:https://forum.unity.com/threads/fails-to-compile-on-android-arm-32.1135633/
一个用户提到了一个解决方案(归功于pradotech),它最终为我解决了这个问题:
我可以在修改后使用主编译器为Android构建剥离级别到中等(我使用低),并从。net切换框架到。net标准2.1。细节如下:
- 统一2021.3.9f1
- 更快运行时
压缩:LZ4HC API兼容性:.NET Standard 2.1- 编译器配置:Master
- 所有架构(ARMv7, ARM64, x86和x86-64)
- 管理剥离级别:中/高
- 我还从项目中删除了一些未使用的脚本。
构建完成,没有任何错误。
希望它能继续工作,也许能帮助到别人。
我的项目是使用Unity 2021.3.14f1,我已经在。net标准2.1。我将剥离改为Medium,删除了一堆不推荐的脚本,现在它又工作了。