Unity IL2CPP Window打包常见错误解决方案

16 篇文章 3 订阅

Chinar blog www.chinar.xin

Unity IL2CPP Window错误集合


本文提供全流程,中文翻译

助力快速解决 Unity IL2CPP 打包异常

为初学者节省宝贵的时间,避免采坑!

Chinar —— 心分享、心创新!

我们的初衷是将一种简单的生活方式带给世人

使有限时间 具备无限可能

Chinar 教程效果:



全文高清图片,点击即可放大观看 (很多人竟然不知道)


Intro —— 简介


IL2CPP 打包方式的优点不用我说,网上能搜到一堆讲的很官方的教程

总之成品项目发布版本时,用它就对了

但这种打包方式,各种的花式报错。而且Baidu 搜索不到与之对应的解决方案,对初学者来讲这点尤为头疼!

举个例子


4

Quote UnityEditor —— 脚本引用 UnityEditor,导致无法打包


错误发生场景

打包项目/工程时报错

Unity IL2CPP 无论怎样都报错,甚至新建空项目打包也报错!
举个例子

具体报错信息:
Failed running D:\WorkWare\UnityHub\Unity\2018.4.13c1\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="WindowsDesktop" --architecture="x64" --configuration="Release" --outputpath="D:\WorkWare\WorkProject\TEST\Chinar String Edge\Temp/StagingArea/Data\Native\GameAssembly.dll" --cachedirectory="D:\WorkWare\WorkProject\TEST\Chinar String Edge\Assets\..\Library/il2cpp_cache" --map-file-parser="D:\WorkWare\UnityHub\Unity\2018.4.13c1\Editor\Data\Tools\MapFileParser\MapFileParser.exe" --directory="D:\WorkWare\WorkProject\TEST\Chinar String Edge\Temp\StagingArea\Data\Managed" --generatedcppdir="D:\WorkWare\WorkProject\TEST\Chinar String Edge\Temp\StagingArea\Data\il2cppOutput" 
stdout:
il2cpp.exe didn't catch exception: System.InvalidOperationException: C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
        Visual Studio 2010 with C++ compilers and Windows 7 SDK (it cannot build C++ code because it is not installed)
        Visual Studio 2010 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\10.0_Config\InstallDir" in the registry
        Windows 7 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\InstallationFolder" in the registry
        Visual Studio 2013 with C++ compilers and Windows 8.1 SDK (it cannot build C++ code because it is not installed)
        Visual Studio 2013 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\12.0_Config\InstallDir" in the registry
        Windows 8.1 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1\InstallationFolder" in the registry
        Visual Studio 2015 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
        Visual Studio 2015 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry
        Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
        Visual Studio 2017 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
        Visual Studio 2017 installation is found using Microsoft.VisualStudio.Setup.Configuration COM APIs
        Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
   �� Unity.IL2CPP.Building.CppProgramBuilder.ThrowIfCannotBuildInCurrentEnvironment()
   �� Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
   �� il2cpp.Program.DoRun(String[] args)
   �� il2cpp.Program.Run(String[] args)
   �� il2cpp.Program.Main(String[] args)
stderr:
δ��������쳣:  System.InvalidOperationException: C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
        Visual Studio 2010 with C++ compilers and Windows 7 SDK (it cannot build C++ code because it is not installed)
        Visual Studio 2010 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\10.0_Config\InstallDir" in the registry
        Windows 7 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\InstallationFolder" in the registry
        Visual Studio 2013 with C++ compilers and Windows 8.1 SDK (it cannot build C++ code because it is not installed)
        Visual Studio 2013 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\12.0_Config\InstallDir" in the registry
        Windows 8.1 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1\InstallationFolder" in the registry
        Visual Studio 2015 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
        Visual Studio 2015 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry
        Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
        Visual Studio 2017 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
        Visual Studio 2017 installation is found using Microsoft.VisualStudio.Setup.Configuration COM APIs
        Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
   �� Unity.IL2CPP.Building.CppProgramBuilder.ThrowIfCannotBuildInCurrentEnvironment()
   �� Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
   �� il2cpp.Program.DoRun(String[] args)
   �� il2cpp.Program.Run(String[] args)
   �� il2cpp.Program.Main(String[] args)
Exception: D:\WorkWare\UnityHub\Unity\2018.4.13c1\Editor\Data\il2cpp/build/il2cpp.exe did not run properly!
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in D:\unity\Editor\Mono\BuildPlayerWindowBuildMethods.cs:194 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in D:\unity\Editor\Mono\BuildPlayerWindowBuildMethods.cs:97 

在这里插入图片描述

解决方案:
  • 根据控制台输出内容,我们可以得知是电脑没安装相应 WindowsSDK 造成的

  • 打开 VS 选项中找到获取新功能,安装 window10 /对应 系统SDK)

  • 即可成功打包工程

举个例子
在这里插入图片描述

在这里插入图片描述


支持

May Be —— 开发者,总有一天要做的事!


拥有自己的服务器,无需再找攻略

Chinar 提供一站式《零》基础教程

使有限时间 具备无限可能!

先点击领取 —— 阿里全产品优惠券 (享受最低优惠)


Chinar 免费服务器、建站教程全攻略!( Chinar Blog )


Chinar

END

本博客为非营利性个人原创,除部分有明确署名的作品外,所刊登的所有作品的著作权均为本人所拥有,本人保留所有法定权利。违者必究

对于需要复制、转载、链接和传播博客文章或内容的,请及时和本博主进行联系,留言,Email: ichinar@icloud.com

对于经本博主明确授权和许可使用文章及内容的,使用时请注明文章或内容出处并注明网址

  • 11
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值