Home > Enterprise >  Unity no longer able to build project
Unity no longer able to build project

Time:12-18

I've been banging my head against the wall the last 6 days or so trying to get Unity to build my Android game.

My game used to build as it should a few months back, I had a couple new things I came up with and added those (the game runs fine within Unity, there are no errors in play mode).

Trying to build my game with the C compiler set to the 'master', however, consistently fails, with the following exceptions:

1.

Building Library\Bee\artifacts\Android\fy9m9\libil2cpp.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/bin\ld.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&)

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&)

UnityEditor.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&)

Things I've tried so far:

  • Building with the C Compiler Configuration set to 'release' also compiles
  • I can build the project if I switch the platform to Windows
  • It seems the project can build if I set the compiler to 'debug' instead of 'master', this does not solve the problem, but might be a clue to the actual problem(?)
  • Making sure it was not caused by something I added: I loaded up the backup of my game (version 1.0, which worked fine and is also published), but the backup can also no longer be build.
  • Making sure the problem is not with Unity itself, I tried to do a build of a clean project. This works as expected.
  • I updated all packages in my project
  • I updated the Unity version my project uses to 2021.3.14f1 (which I also use for another Android project, which can be build with that version).
  • Updated the Google Play Games for Unity Plugin (https://github.com/playgameservices/play-games-plugin-for-unity) and accompanying code changes that were required
  • Per response on Reddit, I made sure that no script uses the UnityEditor namespace (the few that do, are put with #IF UNITY_EDITOR commands

CodePudding user response:

Thanks to user jdweng I managed to find the problem by looking at it from a different angle. Which led me to a post on the Unity Forums with someone who has the exact same problem I described: https://forum.unity.com/threads/fails-to-compile-on-android-arm-32.1135633/

One user there mentions a solution (credits to pradotech), which ended up fixing the problem for me:

I could build for Android using Master compiler after changing Stripping Level to Medium (I was using Low) and switching from .NET Framework to .NET Standard 2.1. Details below:

  • Unity 2021.3.9f1
  • Faster runtime
  • Compression: LZ4HC API
  • Compatibility: .NET Standard 2.1
  • Compiler Configuration: Master
  • All architectures (ARMv7, ARM64, x86 and x86-64)
  • Managed Stripping Level: Medium/High
  • I also removed some unused scripts from project.

Build completed without any errors.

Hope it keeps working and maybe that helps someone.

My project is using Unity 2021.3.14f1, I was already on .Net Standard 2.1. I changed stripping to Medium, removed a bunch of deprecated scripts and now it works again.

  • Related