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.
Error building Player: 2 errors
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errorsat UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


解决方案:

更改 公司名 / 包名 / 项目名


------


2

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

错误发生场景

一般高版本的 2017.2-2017.3 都不会报此错误

常见于 5.X 版本

具体报错信息:
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 版本

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)
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 errorsat 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 中关闭该选项

即可成功打包工程



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 errorsat 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 的文件夹)

即可成功打包工程



5

Socket: bind failed, error: —— 套接字绑定失败

错误发生场景

打开/新建 Unity 项目时报错

这是由于权限不够,或者网络端口被占用造成的

具体报错信息:
Socket: bind failed, error: 以一种访问权限不允许的方式做了一个访问套接字的尝试。
(0)
Unable to join player connection multicast group.

解决方案:

1. 直接 Clear 清空控制台,不用理它

2. 用管理员权限打开 Unity (可选)


5

In continuous update —— 持续更新中…

错误发生场景

错误不断更新中…最后汇集所有报错指南

请您惠存,支持 Chinar


支持

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

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

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

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


Chinar 知你所想,予你所求!( Chinar Blog )



END

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

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

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

Unity打安卓包 Android 所有错误解决方案大全(几乎囊括所有打包错误 )相关推荐

  1. php源码编译常见错误解决方案大全

    php源码编译常见错误解决方案大全 http://www.cnlvzi.com/index.php/Index/article/id/143 在CentOS编译PHP5的时候有时会遇到以下的一些错误信 ...

  2. Unity 解决安卓包激励视频广告退后台再进入APP广告消失

    Unity到处apk包 , 装到手机上发现看广告的途中只要退到后台再点icon打开APP的时候 广告就消失掉了 , 不是专门做安卓的 , 查了好久没找到解决方法 , 今天查到一个方法 试了一下 完美解 ...

  3. unity 打安卓包 华为手机图片被压扁

    加一行 Screen.SetResolution(Screen.width, Screen.height, true);

  4. Unity中AB包详解(超详细,特性,打包,加载,管理器)

    Unity中的AssetBundle详解 AssetBundle的概念 AssetBundle又称AB包,是Unity提供的一种用于存储资源的资源压缩包. Unity中的AssetBundle系统是对 ...

  5. 这两天用unity做安卓蓝牙demo遇到打包安卓包时报错 The option ‘android.enableR8’ is deprecated and should not be used anym

    这两天用unity做安卓蓝牙demo遇到打包安卓包时报错 The option 'android.enableR8' is deprecated and should not be used anym ...

  6. unity发布android报错,Unity移动端入门 - Android那些事 /AAR包发布错误

    老师,您好! Unity移动端入门 - Android那些事的第31节 发布JAR包我两次都成功了,但任务32:0506-互相调用模式之导出Aar包 总是失败,卡在这里都半个月了.请老师指点迷津 打包 ...

  7. Unity调用安卓Android的Toast

    需求:在游戏中弹窗消息,调起安卓的Toast 项目中需要做Unity和安卓交互时,经常需要通过安卓Toast来做简单的输出,以便于测试. 方法一:Unity中,C#主导 // Unity调用安卓的土司 ...

  8. Fiddler抓包抖音网络错误解决方案

    最近呢,挺磕碜的,因某些原因接触了一下抖音抓包api,但是因一些签名算法等问题被劝退了,貌似从app逆向上可以攻克抖音的一些限制,不过技术较菜,被劝退了 = = 以下内容可能有些难以阅读,请仔细阅读, ...

  9. 错误 程序包android.app不存在,运行.app时Android Studio获取包名称错误

    运行.app时Android Studio获取包名称错误 我将程序包名称从com.mycompany.myapplication更改为com.mycompany.testapp. 一切都构建良好,但是 ...

  10. Android Process 'command 'C:\Users\Win\AppData\Local\Android\Sdk\build-t non-zero exit value 1错误解决方案

    Process 'command '*****'' finished with non-zero exit value 1错误解决方案 一. 布局: 1.图片,drawable中的图片名字不对,或者引 ...

最新文章

  1. 【高并发】一个工作了7年的朋友去面试竟然被Thread类虐的体无完肤
  2. velocity 模板引擎
  3. uniapp自定义导航栏
  4. 真正的自重...小偷可以灭绝
  5. 【工具篇】接口测试神器 -- Postman 入门教程
  6. gnokii 短信猫 中文安装使用文档
  7. visual studio code python环境配置_visual-pushing-grasping环境配置及复现
  8. Linux cp命令 拷贝文件
  9. js循环判断有无重复值_JavaScript中的while循环
  10. java 减少内存_java中减少内存占用小技巧
  11. java 微信隐藏右上角_React Js 微信禁止复制链接分享禁止隐藏右上角菜单功能
  12. python读txt写入excel_Python读取txt内容写入xls格式excel中的方法
  13. Cross-Site Scripting(XSS): 跨站脚本攻击介绍
  14. Android实现QQ登录
  15. linux thrift 头文件,Thrift官方安装手冊(译)
  16. 什么事数据补全_事无补
  17. WPF实现炫酷趋势图
  18. ld-linux-x86-64.so.2挖矿木马,排查操作记录
  19. jsp中点击img放大图片
  20. [Flask] [Python3] 第一个flask APP

热门文章

  1. 微服务网关Gateway基本知识(一)
  2. (六)jmeter接口自动化难点系列---jmeter使用base64解密
  3. Android默认头像那些事儿
  4. UnityShder法线贴图
  5. grpc系列1-K8S集群,VIP,grpc._channel._InactiveRpcError connection reset by peer解决方案 Paddleserving服务化部署
  6. 服务器修改密码后任务暂停,windows server 2012 改密码后计划任务执行失败
  7. 副业刚需——做哪些自媒体确实可以挣到钱?
  8. 一句话知道handler有啥ruan用
  9. 计算机网络谢希仁第七版课后习题答案(第七章)
  10. 佛法在世间不离世间觉离世求佛法犹如觅兔角