Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug 2020.1.3f1 IL2CPP Build Error (BuildIl2CppTask: Sequence contains no matching)

Discussion in 'Editor & General Support' started by nicolasgramlich, Aug 28, 2020.

  1. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231
    Hey everyone,

    So I took the dive and jumped on 2020.1 and I did indeed run into an error trying to build for Android.
    This is the error:

    Code (CSharp):
    1. > Task :unityLibrary:BuildIl2CppTask FAILED
    2. Running il2cpp.exe in workstation GC mode.
    3. il2cpp.exe didn't catch exception: System.InvalidOperationException: Sequence contains no matching element
    4.  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    5.  at Unity.Options.OptionsParser.ParseEnumValue (System.Type type, System.String value) [0x00024] in <7ba99c4b386f49249f563198b86bf734>:0
    6.  at Unity.Options.OptionsParser.ParseValue (System.Type type, System.String value, System.Func`3[T1,T2,TResult] customValueParser) [0x00019] in <7ba99c4b386f49249f563198b86bf734>:0
    7.  at Unity.Options.OptionsParser.SetBasicType (System.Reflection.FieldInfo field, System.String v, System.Func`3[T1,T2,TResult] customValueParser, System.Object instance) [0x00008] in <7ba99c4b386f49249f563198b86bf734>:0
    8.  at Unity.Options.OptionsParser+<>c__DisplayClass35_0.<ActionFor>b__5 (System.String v) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    9.  at NDesk.Options.OptionSet+<>c__DisplayClass14_0.<Add>b__0 (NDesk.Options.OptionValueCollection v) [0x0000d] in <7ba99c4b386f49249f563198b86bf734>:0
    10.  at NDesk.Options.OptionSet+ActionOption.OnParseComplete (NDesk.Options.OptionContext c) [0x0000c] in <7ba99c4b386f49249f563198b86bf734>:0
    11.  at NDesk.Options.Option.Invoke (NDesk.Options.OptionContext c) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    12.  at NDesk.Options.OptionSet.ParseValue (System.String option, NDesk.Options.OptionContext c) [0x00089] in <7ba99c4b386f49249f563198b86bf734>:0
    13.  at NDesk.Options.OptionSet.Parse (System.String argument, NDesk.Options.OptionContext context) [0x0007c] in <7ba99c4b386f49249f563198b86bf734>:0
    14.  at NDesk.Options.OptionSet.Parse (System.Collections.Generic.IEnumerable`1[T] arguments, System.String currentDirectory) [0x00171] in <7ba99c4b386f49249f563198b86bf734>:0
    15.  at Unity.Options.OptionsParser.Parse (System.Collections.Generic.IEnumerable`1[T] commandLine, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory, System.Object[] instances) [0x00009] in <7ba99c4b386f49249f563198b86bf734>:0
    16.  at Unity.Options.OptionsParser.Prepare (System.String[] commandLine, System.Type[] types, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory, System.Object[] instances) [0x00021] in <7ba99c4b386f49249f563198b86bf734>:0
    17.  at Unity.Options.OptionsParser.Prepare (System.String[] commandLine, System.Type[] types, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    18.  at il2cpp.Il2CppOptionParser.ParseArguments (System.String[] args, System.Boolean& continueToRun, System.Int32& exitCode, Unity.IL2CPP.Common.RuntimePlatform& platform, Unity.IL2CPP.Building.BuildingOptions& buildingOptions, System.String& profilerOutput) [0x0005d] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    19.  at il2cpp.Program.Run (System.String[] args, System.Boolean setInvariantCulture) [0x00040] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    20.  at il2cpp.Program.Main (System.String[] args) [0x00000] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    21. > Task :launcher:javaPreCompileRelease
    22. 67 actionable tasks: 4 executed, 63 up-to-date
    23. Unhandled Exception:
    24. System.InvalidOperationException: Sequence contains no matching element
    25.  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    26.  at Unity.Options.OptionsParser.ParseEnumValue (System.Type type, System.String value) [0x00024] in <7ba99c4b386f49249f563198b86bf734>:0
    27.  at Unity.Options.OptionsParser.ParseValue (System.Type type, System.String value, System.Func`3[T1,T2,TResult] customValueParser) [0x00019] in <7ba99c4b386f49249f563198b86bf734>:0
    28.  at Unity.Options.OptionsParser.SetBasicType (System.Reflection.FieldInfo field, System.String v, System.Func`3[T1,T2,TResult] customValueParser, System.Object instance) [0x00008] in <7ba99c4b386f49249f563198b86bf734>:0
    29.  at Unity.Options.OptionsParser+<>c__DisplayClass35_0.<ActionFor>b__5 (System.String v) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    30.  at NDesk.Options.OptionSet+<>c__DisplayClass14_0.<Add>b__0 (NDesk.Options.OptionValueCollection v) [0x0000d] in <7ba99c4b386f49249f563198b86bf734>:0
    31.  at NDesk.Options.OptionSet+ActionOption.OnParseComplete (NDesk.Options.OptionContext c) [0x0000c] in <7ba99c4b386f49249f563198b86bf734>:0
    32.  at NDesk.Options.Option.Invoke (NDesk.Options.OptionContext c) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    33.  at NDesk.Options.OptionSet.ParseValue (System.String option, NDesk.Options.OptionContext c) [0x00089] in <7ba99c4b386f49249f563198b86bf734>:0
    34.  at NDesk.Options.OptionSet.Parse (System.String argument, NDesk.Options.OptionContext context) [0x0007c] in <7ba99c4b386f49249f563198b86bf734>:0
    35.  at NDesk.Options.OptionSet.Parse (System.Collections.Generic.IEnumerable`1[T] arguments, System.String currentDirectory) [0x00171] in <7ba99c4b386f49249f563198b86bf734>:0
    36.  at Unity.Options.OptionsParser.Parse (System.Collections.Generic.IEnumerable`1[T] commandLine, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory, System.Object[] instances) [0x00009] in <7ba99c4b386f49249f563198b86bf734>:0
    37.  at Unity.Options.OptionsParser.Prepare (System.String[] commandLine, System.Type[] types, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory, System.Object[] instances) [0x00021] in <7ba99c4b386f49249f563198b86bf734>:0
    38.  at Unity.Options.OptionsParser.Prepare (System.String[] commandLine, System.Type[] types, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    39.  at il2cpp.Il2CppOptionParser.ParseArguments (System.String[] args, System.Boolean& continueToRun, System.Int32& exitCode, Unity.IL2CPP.Common.RuntimePlatform& platform, Unity.IL2CPP.Building.BuildingOptions& buildingOptions, System.String& profilerOutput) [0x0005d] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    40.  at il2cpp.Program.Run (System.String[] args, System.Boolean setInvariantCulture) [0x00040] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    41.  at il2cpp.Program.Main (System.String[] args) [0x00038] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    42. [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Sequence contains no matching element
    43.  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    44.  at Unity.Options.OptionsParser.ParseEnumValue (System.Type type, System.String value) [0x00024] in <7ba99c4b386f49249f563198b86bf734>:0
    45.  at Unity.Options.OptionsParser.ParseValue (System.Type type, System.String value, System.Func`3[T1,T2,TResult] customValueParser) [0x00019] in <7ba99c4b386f49249f563198b86bf734>:0
    46.  at Unity.Options.OptionsParser.SetBasicType (System.Reflection.FieldInfo field, System.String v, System.Func`3[T1,T2,TResult] customValueParser, System.Object instance) [0x00008] in <7ba99c4b386f49249f563198b86bf734>:0
    47.  at Unity.Options.OptionsParser+<>c__DisplayClass35_0.<ActionFor>b__5 (System.String v) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    48.  at NDesk.Options.OptionSet+<>c__DisplayClass14_0.<Add>b__0 (NDesk.Options.OptionValueCollection v) [0x0000d] in <7ba99c4b386f49249f563198b86bf734>:0
    49.  at NDesk.Options.OptionSet+ActionOption.OnParseComplete (NDesk.Options.OptionContext c) [0x0000c] in <7ba99c4b386f49249f563198b86bf734>:0
    50.  at NDesk.Options.Option.Invoke (NDesk.Options.OptionContext c) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    51.  at NDesk.Options.OptionSet.ParseValue (System.String option, NDesk.Options.OptionContext c) [0x00089] in <7ba99c4b386f49249f563198b86bf734>:0
    52.  at NDesk.Options.OptionSet.Parse (System.String argument, NDesk.Options.OptionContext context) [0x0007c] in <7ba99c4b386f49249f563198b86bf734>:0
    53.  at NDesk.Options.OptionSet.Parse (System.Collections.Generic.IEnumerable`1[T] arguments, System.String currentDirectory) [0x00171] in <7ba99c4b386f49249f563198b86bf734>:0
    54.  at Unity.Options.OptionsParser.Parse (System.Collections.Generic.IEnumerable`1[T] commandLine, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory, System.Object[] instances) [0x00009] in <7ba99c4b386f49249f563198b86bf734>:0
    55.  at Unity.Options.OptionsParser.Prepare (System.String[] commandLine, System.Type[] types, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory, System.Object[] instances) [0x00021] in <7ba99c4b386f49249f563198b86bf734>:0
    56.  at Unity.Options.OptionsParser.Prepare (System.String[] commandLine, System.Type[] types, System.Func`3[T1,T2,TResult] customValueParser, System.String currentDirectory) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
    57.  at il2cpp.Il2CppOptionParser.ParseArguments (System.String[] args, System.Boolean& continueToRun, System.Int32& exitCode, Unity.IL2CPP.Common.RuntimePlatform& platform, Unity.IL2CPP.Building.BuildingOptions& buildingOptions, System.String& profilerOutput) [0x0005d] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    58.  at il2cpp.Program.Run (System.String[] args, System.Boolean setInvariantCulture) [0x00040] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    59.  at il2cpp.Program.Main (System.String[] args) [0x00038] in <3be9f628f5fa469389bd6a91a579ba8a>:0
    60. FAILURE: Build failed with an exception.
    61. * Where:
    62. Build file '/Users/ngramlic/Games/LegionCommander/Temp/Android Master/gradleOut/unityLibrary/build.gradle' line: 161
    63. * What went wrong:
    64. Execution failed for task ':unityLibrary:BuildIl2CppTask'.
    65. > Process 'command '/Applications/Unity/Hub/Editor/2020.1.3f1/Unity.app/Contents/MonoBleedingEdge/bin/mono'' finished with non-zero exit value 1
    66. * Try:
    67. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    68. * Get more help at https://help.gradle.org
    69. BUILD FAILED in 3s
    Where this is the gradle file it's trying to execute:
    Code (CSharp):
    1. def BuildIl2Cpp(String workingDir, String targetDirectory, String architecture, String abi, String configuration) {
    2.     exec {
    3.         commandLine("/Applications/Unity/Hub/Editor/2020.1.3f1/Unity.app/Contents/MonoBleedingEdge/bin/mono",
    4.             workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/net471/il2cpp.exe",
    5.             "--compile-cpp",
    6.             "--libil2cpp-static",
    7.             "--platform=Android",
    8.             "--architecture=" + architecture,
    9.             "--configuration=" + configuration,
    10.             "--outputpath=" + workingDir + targetDirectory + abi + "/libil2cpp.so",
    11.             "--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache",
    12.             "--additional-include-directories=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/external/bdwgc/include",
    13.             "--additional-include-directories=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/libil2cpp/include",
    14.             "--tool-chain-path=" + android.ndkDirectory,
    15.             "--map-file-parser=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/MapFileParser/MapFileParser.exe",
    16.             "--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput",
    17.             "--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi,
    18.             "--dotnetprofile=unityaot")
    19.         environment "ANDROID_SDK_ROOT", getSdkDir()
    20.     }
    21.     delete workingDir + targetDirectory + abi + "/libil2cpp.sym.so"
    22.     ant.move(file: workingDir + targetDirectory + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so")
    23. }
    24.  
    25. android {
    26.     task BuildIl2CppTask {
    27.         doLast {
    28.               BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), '/src/main/jniLibs/', 'ARMv7', 'armeabi-v7a', 'Master');
    29.               BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), '/src/main/jniLibs/', 'ARM64', 'arm64-v8a', 'Master');
    30.         }
    31.     }
    32.     afterEvaluate {
    33.         if (project(':unityLibrary').tasks.findByName('mergeDebugJniLibFolders'))
    34.             project(':unityLibrary').mergeDebugJniLibFolders.dependsOn BuildIl2CppTask
    35.         if (project(':unityLibrary').tasks.findByName('mergeReleaseJniLibFolders'))
    36.             project(':unityLibrary').mergeReleaseJniLibFolders.dependsOn BuildIl2CppTask
    37.     }
    38.     sourceSets {
    39.         main {
    40.             jni.srcDirs = ["src/main/Il2CppOutputProject"]
    41.         }
    42.     }
    43. }
    Unfortunately I can't modify the generated gradle file was enough in order to print out what it's trying to execute... :confused:

    It appears that maybe IL2CPP isn't invoked properly and fails to parse some options that are being passed in?

    Thanks,
    Nicolas

    Note: Cross-post from: https://forum.unity.com/threads/2020-1-3f1-il2cpp-build-error.959796/
     
  2. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231
    Sidenote: Interestingly it appears that when I export the project and build it using gradle by hand in Android Studio then it does not throw the same error, BUT crashes immediately when running it on an Android phone.
     
    Last edited: Aug 28, 2020
  3. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231
    Repro'd it in an empty URP project in 2020.1.3f1 with this package config:

    {
    "dependencies": {
    "com.unity.collab-proxy": "1.3.8",
    "com.unity.ide.rider": "1.2.1",
    "com.unity.ide.visualstudio": "2.0.2",
    "com.unity.ide.vscode": "1.2.1",
    "com.unity.platforms.android": "0.8.0-preview.7",
    "com.unity.render-pipelines.universal": "8.2.0",
    "com.unity.test-framework": "1.1.16",
    "com.unity.textmeshpro": "3.0.1",
    "com.unity.timeline": "1.3.4",
    "com.unity.ugui": "1.0.0",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
    }
    }



    Bug ID: https://fogbugz.unity3d.com/default.asp?1273917_bmoc1968lnp7kc3c