在 Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
在 Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
在 il2cpp.Program.DoRun(String[] args)
在 il2cpp.Program.Run(String[] args)
在 il2cpp.Program.Main(String[] args)
stderr:
未经处理的异常: Unity.IL2CPP.Building.BuilderFailedException: F:\Environment\NDK\android-ndk-r16b-windows-x86_64\android-ndk-r16b\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @"C:\Users\Administrator\AppData\Local\Temp\tmp4146.tmp" -o "F:\Unity\CrushMiner\CrushMiner9.11Optimize2018.4.1\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_37EBD535B6A775512618C151CBF4CE6A\libil2cpp.so" -shared -Wl,-soname,libil2cpp.so -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--build-id --sysroot "F:\Environment\NDK\android-ndk-r16b-windows-x86_64\android-ndk-r16b\platforms\android-16\arch-arm" -gcc-toolchain "F:\Environment\NDK\android-ndk-r16b-windows-x86_64\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64" -target armv7-none-linux-androideabi -Wl,--wrap,sigaction -L "F:\Environment\NDK\android-ndk-r16b-windows-x86_64\android-ndk-r16b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a" -lgnustl_static -llog -rdynamic -fuse-ld=gold.exe
F:\Unity\CrushMiner\CrushMiner9.11Optimize2018.4.1\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp_9.cpp:34995: error: undefined reference to \'_copyToPasteboardWithText\'
F:\Unity\CrushMiner\CrushMiner9.11Optimize2018.4.1\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp_9.cpp:35099: error: undefined reference to \'_shareWithText\'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
在 Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
在 Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
在 il2cpp.Program.DoRun(String[] args)
在 il2cpp.Program.Run(String[] args)
在 il2cpp.Program.Main(String[] args)
UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:368)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:349)
UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:211)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:35)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
解决方法:查看中断信息:
在未经处理的异常:下面一段找到error,error: undefined reference to \'_copyToPasteboardWithText\'
error:undefined reference to \'_shareWithText\',说未定义的引用。
这个可能是你ios的调用方法(我的是ios的方法),然后在代码中找到用条件编译命令#if改掉就ok了
我的方法
[DllImport("__Internal")]
private static extern void _copyToPasteboardWithText(string text);
改成
#if UNITY_IOS
[DllImport("__Internal")]
private static extern void _copyToPasteboardWithText(string text);
#endif
所有问题解决,完美打包运行!!!
有什么问题或错误的地方欢迎讨论指正,谢谢。