Search Unity

Bug Cannot build for Android

Discussion in 'Android' started by wagenheimer, Dec 28, 2021.

  1. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    Using Unity 2021.2.7 and I can't build my project to Android. I'm also using PlayFab and Facebook SDK.
    I also can't build it on Unity 2021.1.27f1.

    Code (csharp):
    1.  
    2. BuildFailedException: Incremental Player build failed!
    3. UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
    4. UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
    5. UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <374d68101b9e4829844c8329406f32cc>:0)
    6. 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 <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
    7. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    8.  
    Code (csharp):
    1.  
    2. Building Library\Bee\artifacts\Android\d8kzr\dljh_firstpass1.o failed with output:
    3. E:\Games\Green Sauce Games\Hopes Farm (Free to Play)\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp-firstpass1.cpp(17178,50): warning: backslash and newline separated by space [-Wbackslash-newline-escape]
    4.                 // vertices[3] = CardinalToVertex(3); // [-]   \      
    5.                                                                ^
    6. E:\Games\Green Sauce Games\Hopes Farm (Free to Play)\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp-firstpass1.cpp(17182,13): error: use of undeclared identifier 'L_6'; did you mean 'L_0'?
    7.                 NullCheck(L_6);
    8.                           ^~~
    9.                           L_0
    10. E:\Games\Green Sauce Games\Hopes Farm (Free to Play)\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp-firstpass1.cpp(17161,60): note: 'L_0' declared here
    11.                 Vector3U5BU5D_tFF1859CCE176131B909E2044F76443064254679C* L_0 = __this->___vertices_17;
    12.                                                                          ^
    13. E:\Games\Green Sauce Games\Hopes Farm (Free to Play)\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp-firstpass1.cpp(17183,4): error: use of undeclared identifier 'L_6'; did you mean 'L_0'?
    14.                 (L_6)->SetAt(static_cast<il2cpp_array_size_t>(3), (Vector3_t24C512C7B96BBABAD472002D0BA2BDA40A5A80B2)L_7);
    15.                  ^~~
    16.                  L_0
    17. E:\Games\Green Sauce Games\Hopes Farm (Free to Play)\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp-firstpass1.cpp(17161,60): note: 'L_0' declared here
    18.                 Vector3U5BU5D_tFF1859CCE176131B909E2044F76443064254679C* L_0 = __this->___vertices_17;
    19.                                                                          ^
    20. In file included from E:/Games/Green Sauce Games/Hopes Farm (Free to Play)/Library/Bee/artifacts/Android/il2cppOutput/cpp/Assembly-CSharp-firstpass1.cpp:1:
    21. In file included from C:/Unity/2021.2.7f1/Editor/Data/il2cpp/libil2cpp/pch\pch-cpp.hpp:6:
    22. In file included from C:/Unity/2021.2.7f1/Editor/Data/il2cpp/libil2cpp\codegen/il2cpp-codegen.h:10:
    23. In file included from C:/Unity/2021.2.7f1/Editor/Data/il2cpp/libil2cpp\codegen/il2cpp-codegen-il2cpp.h:3:
    24. C:\Unity\2021.2.7f1\Editor\Data\il2cpp\libil2cpp\codegen\il2cpp-codegen-common-small.h(39,20): warning: implicit conversion from 'long' to 'int' changes value from -9223372036854775808 to 0 [-Wconstant-conversion]
    25.             return INT64_MIN;
    26.             ~~~~~~ ^~~~~~~~~
    27. C:\Unity\2021.2.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\stdint.h(187,56): note: expanded from macro 'INT64_MIN'
    28. #define INT64_MIN        (INT64_C(-9223372036854775807)-1)
    29.                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
    30. E:\Games\Green Sauce Games\Hopes Farm (Free to Play)\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp-firstpass1.cpp(7414,10): note: in instantiation of function template specialization 'il2cpp_codegen_cast_double_to_int<int>' requested here
    31.                 return il2cpp_codegen_cast_double_to_int<int32_t>(((float)il2cpp_codegen_add(((float)il2cpp_codegen_add(((float)il2cpp_codegen_add(((float)il2cpp_codegen_add(((float)il2cpp_codegen_add(L_0, L_1)), L_2)), L_3)), L_4)), L_5)));
    32.                        ^
    33. 2 warnings and 2 errors generated.
    34. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    35.  
     
  2. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    I sent a bug report with my entire project. 1391435

    I found the reason and I was able to fix it (by disabling this function). This code for some reason was causing the build failure. It seems some kind of bug when converting it with IL2CPP.

    Code (csharp):
    1.  
    2.         void MakeVertices()
    3.         {                                                         //        2_____1
    4.             vertices[0] = CardinalToVertex(0); // [-]    /     \
    5.             vertices[1] = CardinalToVertex(1); // [/]   /       \
    6.             vertices[2] = CardinalToVertex(2); // [\]  3    #    0
    7.             vertices[3] = CardinalToVertex(3); // [-]   \       /
    8.             vertices[4] = CardinalToVertex(4); // [/]    \_____/
    9.             vertices[5] = CardinalToVertex(5); // [\]    4     5
    10.         }
    11.  
    It's a simple code, it does not make sense. Here are some more functions needed by this code :

    Code (csharp):
    1.  
    2.         ///<summary>Maps cardinal direction to direction hex to vertex.</summary>
    3.         Vector3 CardinalToHex(int d)
    4.         {
    5.             Vector4 result;
    6.             switch (d)
    7.             {
    8.                 case 0: result = new Vector4(1, 0, -1); break;
    9.                 case 1: result = new Vector4(0, 1, -1); break;
    10.                 case 2: result = new Vector4(-1, 1, 0); break;
    11.                 case 3: result = new Vector4(-1, 0, 1); break;
    12.                 case 4: result = new Vector4(0, -1, 1); break;
    13.                 case 5: result = new Vector4(1, -1, 0); break;
    14.                 default: throw new ArgumentOutOfRangeException();
    15.             }
    16.             var hex = Grid.CubicToWorld(result) - Grid.CubicToWorld(Vector4.zero);
    17.             return hex;
    18.         }
    19.  
    Well... I sent the full project. The bug happens on all recent Unity Versions.
     
  3. mech_alina

    mech_alina

    Joined:
    Nov 3, 2020
    Posts:
    27
    I am using Unity 2021.2.9f1 and I am getting the same errors trying to build to Android. I can build to Android using Mono instead of IL2CPP. If there are any updates on how to fix this, please post in this thread!
     
  4. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    mech_alina likes this.