Problems with Build an Run for Android in Unity 2021.1.0b5

Hello. I download Unity 2021.10b5, and I have problems with this version. I pressed Build and Run button for test my app, but appears 13 errors. I included screenshot for your information.

I have included all the list of errors appear in the Console:

1. Assertion failed on expression: ‘ins.second || ins.first->second == artifactID || (ins.first->second ==
CircularDependencyArtifactID() && !artifactID.IsValid()) || GetPathFromAssetGuidV2(key.GetGUID()).ends_with(“.cs”)’
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

2. File C:\Users\User.android\repositories.cfg could not be loaded.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

3 Assembly for Assembly Definition File ‘Packages/com.unity.xiaomi/Xiaomi.asmdef’ will not be compiled, because it has no scripts associated with it.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

4 Type ‘[UnityEngine.UI]UnityEngine.UI.InputField’ has an extra field ‘m_OnEndEdit’ of type ‘UnityEngine.UI.InputField+EndEditEvent’ in the player and thus can’t be serialized (expected ‘m_OnValueChanged’ of type ‘UnityEngine.UI.InputField+OnChangeEvent’)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

5 Type ‘[UnityEngine.UI]UnityEngine.UI.InputField’ has an extra field ‘m_OnSubmit’ of type ‘UnityEngine.UI.InputField+SubmitEvent’ in the player and thus can’t be serialized (expected ‘m_OnValueChanged’ of type ‘UnityEngine.UI.InputField+OnChangeEvent’)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

6.
Fields serialized in Editor, class ‘UnityEngine.UI.InputField’
‘m_TextComponent’ of type ‘UnityEngine.UI.Text’
‘m_Placeholder’ of type ‘UnityEngine.UI.Graphic’
‘m_ContentType’ of type ‘UnityEngine.UI.InputField+ContentType’
‘m_InputType’ of type ‘UnityEngine.UI.InputField+InputType’
‘m_AsteriskChar’ of type ‘System.Char’
‘m_KeyboardType’ of type ‘UnityEngine.TouchScreenKeyboardType’
‘m_LineType’ of type ‘UnityEngine.UI.InputField+LineType’
‘m_HideMobileInput’ of type ‘System.Boolean’
‘m_CharacterValidation’ of type ‘UnityEngine.UI.InputField+CharacterValidation’
‘m_CharacterLimit’ of type ‘System.Int32’
‘m_OnEndEdit’ of type ‘UnityEngine.UI.InputField+SubmitEvent’
‘m_OnValueChanged’ of type ‘UnityEngine.UI.InputField+OnChangeEvent’
‘m_CaretColor’ of type ‘UnityEngine.Color’
‘m_CustomCaretColor’ of type ‘System.Boolean’
‘m_SelectionColor’ of type ‘UnityEngine.Color’
‘m_Text’ of type ‘System.String’
‘m_CaretBlinkRate’ of type ‘System.Single’
‘m_CaretWidth’ of type ‘System.Int32’
‘m_ReadOnly’ of type ‘System.Boolean’
‘m_ShouldActivateOnSelect’ of type ‘System.Boolean’
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

7
Fields serialized in target platform, class ‘UnityEngine.UI.InputField’
‘m_TextComponent’ of type ‘UnityEngine.UI.Text’
‘m_Placeholder’ of type ‘UnityEngine.UI.Graphic’
‘m_ContentType’ of type ‘UnityEngine.UI.InputField+ContentType’
‘m_InputType’ of type ‘UnityEngine.UI.InputField+InputType’
‘m_AsteriskChar’ of type ‘System.Char’
‘m_KeyboardType’ of type ‘UnityEngine.TouchScreenKeyboardType’
‘m_LineType’ of type ‘UnityEngine.UI.InputField+LineType’
‘m_HideMobileInput’ of type ‘System.Boolean’
‘m_CharacterValidation’ of type ‘UnityEngine.UI.InputField+CharacterValidation’
‘m_CharacterLimit’ of type ‘System.Int32’
‘m_OnEndEdit’ of type ‘UnityEngine.UI.InputField+EndEditEvent’
‘m_OnSubmit’ of type ‘UnityEngine.UI.InputField+SubmitEvent’
‘m_OnValueChanged’ of type ‘UnityEngine.UI.InputField+OnChangeEvent’
‘m_CaretColor’ of type ‘UnityEngine.Color’
‘m_CustomCaretColor’ of type ‘System.Boolean’
‘m_SelectionColor’ of type ‘UnityEngine.Color’
‘m_Text’ of type ‘System.String’
‘m_CaretBlinkRate’ of type ‘System.Single’
‘m_CaretWidth’ of type ‘System.Int32’
‘m_ReadOnly’ of type ‘System.Boolean’
‘m_ShouldActivateOnSelect’ of type ‘System.Boolean’
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

8
Type ‘[Unity.TextMeshPro]TMPro.TextMeshPro’ has an extra field ‘_SortingLayer’ of type ‘System.Int32’ in the player and thus can’t be serialized (expected ‘m_hasFontAssetChanged’ of type ‘System.Boolean’)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

9
Type ‘[Unity.TextMeshPro]TMPro.TextMeshPro’ has an extra field ‘_SortingLayerID’ of type ‘System.Int32’ in the player and thus can’t be serialized (expected ‘m_hasFontAssetChanged’ of type ‘System.Boolean’)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

10
Type ‘[Unity.TextMeshPro]TMPro.TextMeshPro’ has an extra field ‘_SortingOrder’ of type ‘System.Int32’ in the player and thus can’t be serialized (expected ‘m_hasFontAssetChanged’ of type ‘System.Boolean’)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

11
Fields serialized in Editor, class ‘TMPro.TextMeshPro’
‘m_hasFontAssetChanged’ of type ‘System.Boolean’
‘m_renderer’ of type ‘UnityEngine.Renderer’
‘m_maskType’ of type ‘TMPro.MaskingTypes’
‘_SortingLayer’ of type ‘System.Int32’
‘_SortingLayerID’ of type ‘System.Int32’
‘_SortingOrder’ of type ‘System.Int32’
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

12
Fields serialized in target platform, class ‘TMPro.TextMeshPro’
‘_SortingLayer’ of type ‘System.Int32’
‘_SortingLayerID’ of type ‘System.Int32’
‘_SortingOrder’ of type ‘System.Int32’
‘m_hasFontAssetChanged’ of type ‘System.Boolean’
‘m_renderer’ of type ‘UnityEngine.Renderer’
‘m_maskType’ of type ‘TMPro.MaskingTypes’
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

13
Error building player because script class layout is incompatible between the editor and the player.

14
Build completed with a result of ‘Failed’ in 208 seconds (208271 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

15
UnityEditor.BuildPlayerWindow+BuildMethodException: 10 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in :0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in :0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

[175732-errorsinunity-2-9-2021.pdf|175732]

Could you please help me? Thank you…

I had the same issue in Unity Editor 2021.1.13f1 running on MacOS. My Unity project would run just fine in the Unity Editor. But would throw the above types of errors when building for Android or for iOS. For me this issue was resolved by;

  1. closing the Unity editor.
  2. Deleting the “obj” and the “Library” folder and then
  3. reopening the project in the Unity Editor.

I hope this helps someone.

did you solve it? and how?

I am having the same problem. Unity QA is terrible. What a buggy development system!

Same problem here after i switched to 2021.1.5f1 (no problems before). App runs without problems in the Unity Editor.

Then i try to build for android and i get 13 errors, like

Type ‘[Unity.TextMeshPro]TMPro.TextMeshPro’ has an extra field ‘_SortingLayer’ of type ‘System.Int32’ in the player and thus can’t be serialized

After i re-import TextMeshPro via package manager, it gives 175 errors… Any solutions to this?

I just re-imported all my assets and it built fine after the error.