Unity打安卓包 Android 全部错误解决方案大全(几乎囊括全部打包错误 )

Unity打包出错解决方案


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

Chinar 坚持将简单的生活方式,带给世人!

(拥有更好的阅读体验 —— 高分辨率用户请根据需求调整网页缩放比例)



Chinar —— 心分享、心创新!

助力快速解决 Unity 打包中常见错误

给新手节省宝贵的时间,避免采坑!



1

Change Name —— 未设置修改包名 / 公司名 / 项目名


因为未设置修改 包名 / 公司名 / 项目名javascript

致使报错,最为简单html

具体错误字符:
UnityException: Package Name has not been set up correctly
Please set the Package Name in the Player Settings. The value must follow the convention 'com.YourCompanyName.YourProductName' and can contain alphanumeric characters and underscore.
Each segment must not start with a numeric character or underscore.
Error building Player: 2 errors
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

这里写图片描述
这里写图片描述

解决方案:

更改 公司名 / 包名 / 项目名
举个栗子黑白88
这里写图片描述——这里写图片描述java


2

SDK Tools —— Unity版本低,须要安卓工具版本也低些


通常高版本的2017.2-2017.3都不会报此错误android

常见于 5.X 版本


ruby

具体错误字符:
Error:Invalid command android<br>UnityEditor.HostView:OnGUI()
CommandInvokationFailure: Unable to list target platforms. 
Please make sure the android sdk path is correct. See the Console for more details.
Error building Player: CommandInvokationFailure: 
Unable to list target platforms. 
Please make sure the android sdk path is correct. See the Console for more details.

这里写图片描述
这里写图片描述

解决方案:

更换安卓工具包,至较低的版本服务器

1. 点击下载 —— 安卓工具包 24 版本app

2.解压后替换 安卓 SDK 中的 Tools 文件夹工具

3.而后从新打包,便可成功!!!


反之:若是 Unity 版本高,一样须要换成高版本的 安卓 SDK Tools
举个栗子黑白88
这里写图片描述ui


3

AR Vuforia Android TV —— Vuforia AR 发开中,打包安卓报错


因为 Vuforia 不支持 Android TV ,致使报错spa

具体错误字符:
Vuforia does not support Android TV. Please disable the Android TV compatibility in the Player Settings.

UnityEngine.Debug:LogError(Object)
BuildObserver:OnPreprocessBuild(BuildTarget, String)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Error building Player: Vuforia does not support Android TV. Please disable the Android TV compatibility in the Player Settings.
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88 
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

这里写图片描述

解决方案:

因此须要在 Player Setting 中关闭该选项

便可成功打包工程
举个栗子黑白88
这里写图片描述


4

Quote UnityEditor —— 脚本引用 UnityEditor,没法打包


打包项目/工程时报错

Unity Asset 目录中,若是脚本中引用了 UnityEditor

那么该脚本就应该放在 Editor 文件夹下 ( 若是没有,就新建一个名为 Editor 的文件夹)

具体错误字符:
Assets/CreateGuanJians.cs(4,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?
Error building Player because scripts had compiler errors
Build completed with a result of 'Failed'
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88 
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

这里写图片描述

解决方案:

将引用有 UnityEditor 的脚本放在 Editor 文件夹下

( 若是没有,就新建一个名为 Editor 的文件夹)

便可成功打包工程
举个栗子黑白88
这里写图片描述


5

Update —— 不断更新中…….最后聚集全部报错指南

错误不断更新中…….最后聚集全部报错指南

请您惠存,支持 Chinar


支持

May Be —— 搞开发,总有一天要作的事!


拥有本身的服务器,无需再找攻略!

Chinar 提供一站式教程,闭眼式建立!

为新手节省宝贵时间,避免采坑!


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


1 —— 云服务器超全购买流程 (新手必备!)

2 —— 阿里ECS云服务器自定义配置 - 购买教程(新手必备!)

3—— Windows 服务器配置、运行、建站一条龙 !

4 —— Linux 服务器配置、运行、建站一条龙 !





技术交流群:806091680 ! Chinar 欢迎你的加入


END

本博客为非营利性我的原创,除部分有明确署名的做品外,所刊登的全部做品的著做权均为本人所拥有,本人保留全部法定权利。违者必究 对于须要复制、转载、连接和传播博客文章或内容的,请及时和本博主进行联系,留言,Email: ichinar@icloud.com 对于经本博主明确受权和许可以使用文章及内容的,使用时请注明文章或内容出处并注明网址

相关文章
相关标签/搜索