來源:https://blog.csdn.net/ChinarCSDN/article/details/79597142
本文鏈接:https://blog.csdn.net/ChinarCSDN/article/details/79597142
Chinar blog :www.chinar.xin
Unity打包出錯解決方案
本文提供全流程,中文翻譯
Chinar 的初衷是將一種簡單的生活方式帶給世人
使有限時間 具備無限可能
Chinar —— 心分享、心創新!
助力快速解決 Unity 打包中常見錯誤
給新手節省寶貴的時間,避免采坑!
文章目錄
1
Name not set —— 未設置修改包名 / 公司名 / 項目名
2
SDK Tools —— Unity版本低,需要安卓工具版本也應低些
3
AR Vuforia Android TV —— Vuforia AR 發開中,打包安卓報錯
4
Quote UnityEditor —— 腳本引用 UnityEditor,導致無法打包
5
Socket: bind failed, error: —— 套接字綁定失敗
5
In continuous update —— 持續更新中....
支持
May Be —— 開發者,總有一天要做的事!
1
Name not set —— 未設置修改包名 / 公司名 / 項目名
錯誤發生場景
由於未設置修改 包名 / 公司名 / 項目名
導致報錯,最為簡單
具體報錯信息:
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.
1
2
3
Error building Player: 2 errors
1
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in
1
2
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
1
2
解決方案:
更改 公司名 / 包名 / 項目名
------
2
SDK Tools —— Unity版本低,需要安卓工具版本也應低些
錯誤發生場景
一般高版本的 2017.2-2017.3 都不會報此錯誤
常見於 5.X 版本
具體報錯信息:
Error:Invalid command android<br>UnityEditor.HostView:OnGUI()
1
CommandInvokationFailure: Unable to list target platforms.
Please make sure the android sdk path is correct. See the Console for more details.
1
2
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
2
3
解決方案:
更換安卓工具包,至較低的版本
1. 點擊下載 —— 安卓工具包 24 版本
2. 解壓后替換 安卓 SDK 中的 Tools 文件夾
3. 然后重新打包,即可成功!!!
反之:如果 Unity 版本高,同樣需要換成高版本的 安卓 SDK Tools
3
AR Vuforia Android TV —— Vuforia AR 發開中,打包安卓報錯
錯誤發生場景
由於 Vuforia 不支持 Android TV ,導致報錯
具體報錯信息:
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)
1
2
3
4
5
6
Error building Player: Vuforia does not support Android TV. Please disable the Android TV compatibility in the Player Settings.
1
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
1
2
3
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)
1
2
3
4
5
解決方案:
所以需要在 Player Setting 中關閉該選項
即可成功打包工程
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?
1
Error building Player because scripts had compiler errors
1
Build completed with a result of 'Failed'
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
1
2
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()
1
2
3
4
5
解決方案:
將引用有 UnityEditor 的腳本放在 Editor 文件夾下
( 如果沒有,就新建一個名為 Editor 的文件夾)
即可成功打包工程
5
Socket: bind failed, error: —— 套接字綁定失敗
錯誤發生場景
打開/新建 Unity 項目時報錯
這是由於權限不夠,或者網絡端口被占用造成的
具體報錯信息:
Socket: bind failed, error: 以一種訪問權限不允許的方式做了一個訪問套接字的嘗試。
(0)
1
2
3
Unable to join player connection multicast group.
1
解決方案:
1. 直接 Clear 清空控制台,不用理它
2. 用管理員權限打開 Unity (可選)
5
In continuous update —— 持續更新中…
錯誤發生場景
錯誤不斷更新中…最后匯集所有報錯指南
請您惠存,支持 Chinar
————————————————
版權聲明:本文為CSDN博主「Chinarcsdn」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/ChinarCSDN/article/details/79597142