flutter-unity-view-widget
flutter-unity-view-widget copied to clipboard
Execution failed for task ':unityLibrary:BuildIl2CppTask'.
Describe the bug I'm trying to build my app on android but it fails with the message:
Execution failed for task ':unityLibrary:BuildIl2CppTask'.
[ ] > Process 'command '/Applications/Unity/Hub/Editor/2020.1.17f1/Unity.app/Contents/MonoBleedingEdge/bin/mono'' finished with non-zero exit value 1.
The full Error message looks like that:
[ ] Running il2cpp.exe in workstation GC mode.
[ ] il2cpp.exe didn't catch exception: System.InvalidOperationException: Sequence contains no matching element
[ ] at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in
<351e49e2a5bf4fd6beabb458ce2255f3>:0
[ ] at Unity.Options.OptionsParser.ParseEnumValue (System.Type type, System.String value) [0x00024] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at Unity.Options.OptionsParser.ParseValue (System.Type type, System.String value, System.Func`3[T1,T2,TResult] customValueParser) [0x00019] in
<7ba99c4b386f49249f563198b86bf734>:0
[ ] 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
[ ] at Unity.Options.OptionsParser+<>c__DisplayClass35_0.<ActionFor>b__5 (System.String v) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet+<>c__DisplayClass14_0.<Add>b__0 (NDesk.Options.OptionValueCollection v) [0x0000d] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet+ActionOption.OnParseComplete (NDesk.Options.OptionContext c) [0x0000c] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.Option.Invoke (NDesk.Options.OptionContext c) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.ParseValue (System.String option, NDesk.Options.OptionContext c) [0x00089] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.Parse (System.String argument, NDesk.Options.OptionContext context) [0x0007c] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.Parse (System.Collections.Generic.IEnumerable`1[T] arguments, System.String currentDirectory) [0x00171] in
<7ba99c4b386f49249f563198b86bf734>:0
[ ] 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
[ ] 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
[ ] 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
[ ] 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
[ ] at il2cpp.Program.Run (System.String[] args, System.Boolean setInvariantCulture) [0x00040] in <3be9f628f5fa469389bd6a91a579ba8a>:0
[ ] at il2cpp.Program.Main (System.String[] args) [0x00000] in <3be9f628f5fa469389bd6a91a579ba8a>:0
[ ] Unhandled Exception:
[ ] System.InvalidOperationException: Sequence contains no matching element
[ ] at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in
<351e49e2a5bf4fd6beabb458ce2255f3>:0
[ ] at Unity.Options.OptionsParser.ParseEnumValue (System.Type type, System.String value) [0x00024] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at Unity.Options.OptionsParser.ParseValue (System.Type type, System.String value, System.Func`3[T1,T2,TResult] customValueParser) [0x00019] in
<7ba99c4b386f49249f563198b86bf734>:0
[ ] 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
[ ] at Unity.Options.OptionsParser+<>c__DisplayClass35_0.<ActionFor>b__5 (System.String v) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet+<>c__DisplayClass14_0.<Add>b__0 (NDesk.Options.OptionValueCollection v) [0x0000d] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet+ActionOption.OnParseComplete (NDesk.Options.OptionContext c) [0x0000c] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.Option.Invoke (NDesk.Options.OptionContext c) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.ParseValue (System.String option, NDesk.Options.OptionContext c) [0x00089] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.Parse (System.String argument, NDesk.Options.OptionContext context) [0x0007c] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.Parse (System.Collections.Generic.IEnumerable`1[T] arguments, System.String currentDirectory) [0x00171] in
<7ba99c4b386f49249f563198b86bf734>:0
[ ] 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
[ ] 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
[ ] 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
[ ] 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
[ ] at il2cpp.Program.Run (System.String[] args, System.Boolean setInvariantCulture) [0x00040] in <3be9f628f5fa469389bd6a91a579ba8a>:0
[ ] at il2cpp.Program.Main (System.String[] args) [0x00038] in <3be9f628f5fa469389bd6a91a579ba8a>:0
[ ] [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Sequence contains no matching element
[ ] at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in
<351e49e2a5bf4fd6beabb458ce2255f3>:0
[ ] at Unity.Options.OptionsParser.ParseEnumValue (System.Type type, System.String value) [0x00024] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at Unity.Options.OptionsParser.ParseValue (System.Type type, System.String value, System.Func`3[T1,T2,TResult] customValueParser) [0x00019] in
<7ba99c4b386f49249f563198b86bf734>:0
[ ] 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
[ ] at Unity.Options.OptionsParser+<>c__DisplayClass35_0.<ActionFor>b__5 (System.String v) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet+<>c__DisplayClass14_0.<Add>b__0 (NDesk.Options.OptionValueCollection v) [0x0000d] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet+ActionOption.OnParseComplete (NDesk.Options.OptionContext c) [0x0000c] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.Option.Invoke (NDesk.Options.OptionContext c) [0x00000] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.ParseValue (System.String option, NDesk.Options.OptionContext c) [0x00089] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.Parse (System.String argument, NDesk.Options.OptionContext context) [0x0007c] in <7ba99c4b386f49249f563198b86bf734>:0
[ ] at NDesk.Options.OptionSet.Parse (System.Collections.Generic.IEnumerable`1[T] arguments, System.String currentDirectory) [0x00171] in
<7ba99c4b386f49249f563198b86bf734>:0
[ ] 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
[ ] 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
[ ] 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
[ ] 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
[ ] at il2cpp.Program.Run (System.String[] args, System.Boolean setInvariantCulture) [0x00040] in <3be9f628f5fa469389bd6a91a579ba8a>:0
[ ] at il2cpp.Program.Main (System.String[] args) [0x00038] in <3be9f628f5fa469389bd6a91a579ba8a>:0
[+3595 ms] > Task :flutter_unity_widget:compileReleaseKotlin
[ ] w:
/Users/Work/.pub-cache/hosted/pub.dartlang.org/flutter_unity_widget-2022.1.0+7/android/src/main/kotlin/com/xraph/plugin/flutter_unity_widget/OverrideUnityActivity.kt: (59,
59): Unnecessary safe call on a non-null receiver of type Bundle?
[ ] w:
/Users/Work/.pub-cache/hosted/pub.dartlang.org/flutter_unity_widget-2022.1.0+7/android/src/main/kotlin/com/xraph/plugin/flutter_unity_widget/OverrideUnityActivity.kt: (62,
54): Unnecessary safe call on a non-null receiver of type Bundle?
[ ] w:
/Users/Work/.pub-cache/hosted/pub.dartlang.org/flutter_unity_widget-2022.1.0+7/android/src/main/kotlin/com/xraph/plugin/flutter_unity_widget/OverrideUnityActivity.kt: (72,
54): Unnecessary safe call on a non-null receiver of type Bundle?
[ +195 ms] FAILURE: Build failed with an exception.
[ ] * Where:
[ ] Build file '/Users/Work/Desktop/SnapNext/OrthomolAR/android/unityLibrary/build.gradle' line: 73
[ ] * What went wrong:
[ ] Execution failed for task ':unityLibrary:BuildIl2CppTask'.
[ ] > Process 'command '/Applications/Unity/Hub/Editor/2020.1.17f1/Unity.app/Contents/MonoBleedingEdge/bin/mono'' finished with non-zero exit value 1
[ ] * Try:
[ ] 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.
[ ] * Get more help at https://help.gradle.org
[ ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[ ] Use '--warning-mode all' to show the individual deprecation warnings.
[ ] See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
[ ] BUILD FAILED in 50s
[ ] 271 actionable tasks: 255 executed, 16 up-to-date
[ +426 ms] Running Gradle task 'assembleRelease'... (completed in 54.5s)
[ +22 ms] "flutter apk" took 62,197ms.
[ +6 ms] Gradle task assembleRelease failed with exit code 1
[ ]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:400:9)
<asynchronous suspension>
#2 AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:179:5)
<asynchronous suspension>
#3 BuildApkCommand.runCommand (package:flutter_tools/src/commands/build_apk.dart:112:5)
<asynchronous suspension>
#4 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
<asynchronous suspension>
#5 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#6 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#8 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#9 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#10 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#11 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#12 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
[ +152 ms] ensureAnalyticsSent: 147ms
[ +1 ms] Running shutdown hooks
[ ] Shutdown hooks complete
[ ] exiting with code 1
This is my build.gradle file in the android/app directory:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException('Flutter SDK not found. Define location with flutter.sdk in the local.properties file.')
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
buildTypes {
release {
signingConfig signingConfigs.debug
}
debug {
signingConfig signingConfigs.debug
}
profile {
signingConfig signingConfigs.debug
}
innerTest {
matchingFallbacks = ['debug', 'release']
}
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
debug {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileSdkVersion 31
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
ndkVersion "21.0.6113669"
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId 'com.orthomol.b2bapp'
minSdkVersion 24
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
}
flutter {
source '../..'
}
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation project(':unityLibrary')
implementation platform('com.google.firebase:firebase-bom:26.5.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
}
This is the Gradle File in the android/unityLibrary directory that was generated by unity :
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
apply plugin: 'com.android.library'
dependencies {
implementation(name: 'unity-classes', ext:'jar')
implementation(name: 'ARPresto', ext:'aar')
implementation(name: 'NatCorder', ext:'aar')
implementation(name: 'NatRender', ext:'aar')
implementation(name: 'NativeShare', ext:'aar')
implementation(name: 'UnityARCore', ext:'aar')
implementation(name: 'arcore_client', ext:'aar')
implementation(name: 'unityandroidpermissions', ext:'aar')
}
android {
buildTypes {
release {
signingConfig signingConfigs.debug
}
debug {
signingConfig signingConfigs.debug
}
profile {
signingConfig signingConfigs.debug
}
innerTest {
matchingFallbacks = ['debug', 'release']
}
}
compileSdkVersion 29
buildToolsVersion '30.0.2'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 24
targetSdkVersion 29
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
ndkVersion "21.0.6113669"
versionCode 212
versionName '1.0'
consumerProguardFiles 'proguard-unity.txt'
}
lintOptions {
abortOnError false
}
aaptOptions {
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
doNotStrip '*/arm64-v8a/*.so'
}
}
def getSdkDir() {
Properties local = new Properties()
local.load(new FileInputStream("${rootDir}/local.properties"))
return local.getProperty('sdk.dir')
}
def BuildIl2Cpp(String workingDir, String targetDirectory, String architecture, String abi, String configuration) {
exec {
commandLine("/Applications/Unity/Hub/Editor/2020.1.17f1/Unity.app/Contents/MonoBleedingEdge/bin/mono",
workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/net471/il2cpp.exe",
"--compile-cpp",
"--libil2cpp-static",
"--platform=Android",
"--architecture=" + architecture,
"--configuration=" + configuration,
"--outputpath=" + workingDir + targetDirectory + abi + "/libil2cpp.so",
"--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache",
"--additional-include-directories=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/external/bdwgc/include",
"--additional-include-directories=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/libil2cpp/include",
"--tool-chain-path=" + android.ndkDirectory,
"--map-file-parser=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/MapFileParser/MapFileParser.exe",
"--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput",
"--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi,
"--dotnetprofile=unityaot")
environment "ANDROID_SDK_ROOT", getSdkDir()
}
delete workingDir + targetDirectory + abi + "/libil2cpp.sym.so"
ant.move(file: workingDir + targetDirectory + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so")
}
android {
task BuildIl2CppTask {
doLast {
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), '/src/main/jniLibs/', 'ARMv7', 'armeabi-v7a', 'Master');
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), '/src/main/jniLibs/', 'ARM64', 'arm64-v8a', 'Master');
}
}
afterEvaluate {
if (project(':unityLibrary').tasks.findByName('mergeDebugJniLibFolders'))
project(':unityLibrary').mergeDebugJniLibFolders.dependsOn BuildIl2CppTask
if (project(':unityLibrary').tasks.findByName('mergeReleaseJniLibFolders'))
project(':unityLibrary').mergeReleaseJniLibFolders.dependsOn BuildIl2CppTask
}
sourceSets {
main {
jni.srcDirs = ["src/main/Il2CppOutputProject"]
}
}
}
android.sourceSets.main.java.srcDirs += [
'/Users/Work/Desktop/SnapNext/OrthomolAR/unity/OrthomolARUnity2/Assets/FlutterUnityIntegration/Plugins/Android/OverrideUnityActivity.java'
]
Im currently using flutter_unity_widget: ^2022.1.0+4
Please help. Have been stuck since days...
What version on Unity are you using?
Any chance you have the "Scripting backend" in the Unity player settings set to "Mono"?
Your error contains /MonoBleedingEdge/bin/mono
.
This package requires the scripting backend to be "IL2CPP".
Hi @khalithartmann , Try to upgrade unity to 2022.3.4f1 and use fuw-2022.1.1 package also nice to upgrade flutter unity widget. Later import package few-2022.1.1 into unity project (this package fixes some older issues).