Unity 5和IL2CPP:无法构建

时间:2015-03-22 16:47:23

标签: ios unity3d google-play

过去几天一直在试图将我的机器人应用程序移植到iOS上。

大多数代码都在内部,只使用UnityAds,SIS(简单IAP系统)和GooglePlayGames插件。

启用IL2CCP后,它甚至不会在Unity 5(最新版本)上构建。我收到以下错误:

IL2CPP error for type 'GooglePlayGames.Native.PInvoke.PInvokeUtilities/OutStringMethod' in assembly '/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll'
Additional information: Build a development build for more information. Exception has been thrown by the target of an invocation.

Failed running /Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/il2cpp.exe --copy-level=None --enable-generic-sharing --enable-unity-event-support --emit-null-checks --enable-array-bounds-check --enable-symbol-loading
"/Temp/StagingArea/Data/Managed/Assembly-CSharp-firstpass.dll"
"/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll"
"/Temp/StagingArea/Data/Managed/Assembly-UnityScript.dll"
"/Temp/StagingArea/Data/Managed/UnityEngine.UI.dll" "/Temp/StagingArea/Data/Managed/OpenIAB_W8Plugin.dll" "/Temp/StagingArea/Data/Managed/UnityEngine.Cloud.Analytics.dll"
"/Temp/il2cppOutput/il2cppOutput"

stdout:
IL2CPP error for type 'GooglePlayGames.Native.PInvoke.PInvokeUtilities/OutStringMethod' in assembly '/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll'
Additional information: Build a development build for more information. Exception has been thrown by the target of an invocation.
stderr:

Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Cannot cast from source type to destination type.
at Unity.IL2CPP.IncludeCollection.NonTemplated.TypeDefinitionVisitor.HandleDelegate (Mono.Cecil.TypeDefinition typeDefinition) [0x00000] in :0
at Unity.IL2CPP.IncludeCollection.NonTemplated.TypeDefinitionVisitor.Visit (Mono.Cecil.TypeDefinition typeDefinition, Unity.Cecil.Visitor.Context context) [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0
at Unity.Cecil.Visitor.Visitor.VisitTypeDefinition [0x00000] in :0
at Unity.Cecil.Visitor.Extensions.DoAcceptTypeDefinition [0x00000] in :0
at Unity.Cecil.Visitor.Extensions.Accept (Mono.Cecil.TypeDefinition typeDefinition, Unity.Cecil.Visitor.Visitor visitor) [0x00000] in :0
at Unity.IL2CPP.IncludeCollection.NonTemplated.IncludeCollector.ForTypeDefinition (Mono.Cecil.TypeDefinition type) [0x00000] in :0
at Unity.IL2CPP.IncludeCollection.NonTemplated.IncludeCollector.ForTypeDefinition (Mono.Cecil.TypeReference type) [0x00000] in :0
at Unity.IL2CPP.IncludeWriter.WriteTypeDefinitionIncludes (Mono.Cecil.TypeReference type, Unity.IL2CPP.CppCodeWriter writer) [0x00000] in :0
at Unity.IL2CPP.SourceWriter.WriteTypeDefinitionFor (System.String outputDirectory, Mono.Cecil.TypeReference type) [0x00000] in :0
at Unity.IL2CPP.SourceWriter.Write (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.IL2CPP.GenericsCollection.InflatedCollection allGenerics, System.String outputDir, Mono.Cecil.TypeDefinition[] typeList, Unity.IL2CPP.StringLiterals.StringLiteralCollection stringLiteralCollection) [0x00000] in :0
at Unity.IL2CPP.AssemblyConverter.Convert (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.IL2CPP.StringLiterals.StringLiteralCollection stringLiteralCollection, Unity.IL2CPP.GenericsCollection.InflatedCollection allGenerics) [0x00000] in :0
at Unity.IL2CPP.AssemblyConverter.Apply () [0x00000] in :0
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies (System.String[] assemblies, System.String outputDir) [0x00000] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Cannot cast from source type to destination type.
at Unity.IL2CPP.IncludeCollection.NonTemplated.TypeDefinitionVisitor.HandleDelegate (Mono.Cecil.TypeDefinition typeDefinition) [0x00000] in :0
at Unity.IL2CPP.IncludeCollection.NonTemplated.TypeDefinitionVisitor.Visit (Mono.Cecil.TypeDefinition typeDefinition, Unity.Cecil.Visitor.Context context) [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0
at Unity.Cecil.Visitor.Visitor.VisitTypeDefinition [0x00000] in :0
at Unity.Cecil.Visitor.Extensions.DoAcceptTypeDefinition [0x00000] in :0
at Unity.Cecil.Visitor.Extensions.Accept (Mono.Cecil.TypeDefinition typeDefinition, Unity.Cecil.Visitor.Visitor visitor) [0x00000] in :0
at Unity.IL2CPP.IncludeCollection.NonTemplated.IncludeCollector.ForTypeDefinition (Mono.Cecil.TypeDefinition type) [0x00000] in :0
at Unity.IL2CPP.IncludeCollection.NonTemplated.IncludeCollector.ForTypeDefinition (Mono.Cecil.TypeReference type) [0x00000] in :0
at Unity.IL2CPP.IncludeWriter.WriteTypeDefinitionIncludes (Mono.Cecil.TypeReference type, Unity.IL2CPP.CppCodeWriter writer) [0x00000] in :0
at Unity.IL2CPP.SourceWriter.WriteTypeDefinitionFor (System.String outputDirectory, Mono.Cecil.TypeReference type) [0x00000] in :0
at Unity.IL2CPP.SourceWriter.Write (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.IL2CPP.GenericsCollection.InflatedCollection allGenerics, System.String outputDir, Mono.Cecil.TypeDefinition[] typeList, Unity.IL2CPP.StringLiterals.StringLiteralCollection stringLiteralCollection) [0x00000] in :0
at Unity.IL2CPP.AssemblyConverter.Convert (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.IL2CPP.StringLiterals.StringLiteralCollection stringLiteralCollection, Unity.IL2CPP.GenericsCollection.InflatedCollection allGenerics) [0x00000] in :0
at Unity.IL2CPP.AssemblyConverter.Apply () [0x00000] in :0
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies (System.String[] assemblies, System.String outputDir) [0x00000] in :0

    UnityEngine.Debug:LogError(Object)
    UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:66)
    UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection1, String, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:404) UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:275) UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:211)
UnityEditor.HostView:OnGUI()

Exception: /Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/il2cpp.exe did not run properly!
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:68)
UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (ICollection1 userAssemblies, System.String outputDirectory, System.String workingDirectory) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:404) UnityEditorInternal.IL2CPPBuilder.Run () (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:275) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, IIl2CppPlatformProvider platformProvider, System.Action1 modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:211)
UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.iOSBuildPostprocessor pp, BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String stagingAreaDataManaged, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
UnityEditor.HostView:OnGUI()

Error building Player: Exception: /Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/il2cpp.exe did not run properly!

1 个答案:

答案 0 :(得分:2)

见这里: http://forum.unity3d.com/threads/il2cpp-exe-error.311499/

在这里: https://github.com/playgameservices/play-games-plugin-for-unity/issues/433

其他人正在解决这个问题,特别是谷歌游戏服务插件。我还没有看到解决方案,但Unity链接上的Unity员工说他会调查它。

更新:最新的Unity补丁5.0.0p2为我修复了此错误: http://unity3d.com/unity/qa/patch-releases