unity3d配置Android环境,打包发布Apk流程详解:
首先必须查看你的unity是否安装unityAndroid的打包文件,如果没有(我的建议是你重新下载一遍unity记得勾选Android选项,要不你还是白装,无法打包apk)
一:SDK与JDK下载地址:http://pan.baidu.com/s/1mhVaXHe
下载完成后解压文件
![](http://upload-images.jianshu.io/upload_images/5133784-f37d4af29875619b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/219/format/webp)
安装JDK
![](http://upload-images.jianshu.io/upload_images/5133784-d78132934f0b9654.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/330/format/webp)
分别点击下一步进行安装。
![](http://upload-images.jianshu.io/upload_images/5133784-bfa7427824eebebd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/545/format/webp)
安装中
在安装过程中先后会出现两次选择安装目录的界面,如果默认路径不是以下两个路径,全部改为以下路径,如果是,就不用管:
jdk安装目录:C:Program FilesJavajdk1.6.0_22
jre安装目录:C:Program FilesJavajre6
安装好之后,配置环境变量
三、打开环境变量窗口方法
右键【我的电脑】--单击【属性】--单击【高级】--单击【环境变量】。
![](http://upload-images.jianshu.io/upload_images/5133784-81eeb575562a3ba7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/358/format/webp)
![](http://upload-images.jianshu.io/upload_images/5133784-1b9c6c7350328904.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/727/format/webp)
![](http://upload-images.jianshu.io/upload_images/5133784-0d52afa631471206.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/457/format/webp)
![](http://upload-images.jianshu.io/upload_images/5133784-22a3f1ba1d612547.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/466/format/webp)
一共新建3个环境变量,如下
第一组
变量名:JAVA_HOME
变量值:C:Javajdk1.6.0_22
第二组
变量名:PATH
变量值:%JAVA_HOME%/bin
第三组
变量名:CLASSPATH
变量值:
.;%JAVA_HOME%/lib/tools.jar;%JAVA_HOME%/lib/dt.jar
完成之后点击确定,完成环境变量的配置
![](http://upload-images.jianshu.io/upload_images/5133784-d882e69495fe089b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/716/format/webp)
应用-确定
四:复制android-sdk-windows文件夹到C盘或者D盘或者你可以找到的任意盘任意目录,注意:不能在中文目录下
![](http://upload-images.jianshu.io/upload_images/2020966-cfc46ee15331e0be.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/255/format/webp)
、复制完成之后,打开unity,新建一个项目,打开Edit-Preferences选项
![](http://upload-images.jianshu.io/upload_images/2020966-56d3f6237151dfcb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/333/format/webp)
Edit-Preferences
SDK地址:点击Browse,找到刚刚复制的android-sdk-windows文件夹所在的路径
![](http://upload-images.jianshu.io/upload_images/2020966-0b9df9270cf41a86.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/506/format/webp)
点击Browse
![](http://upload-images.jianshu.io/upload_images/2020966-6b812d04dd5f63f3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/960/format/webp)
选择路径文件夹
JDK地址:C:Program FilesJavajdk1.7.0_67
![](http://upload-images.jianshu.io/upload_images/2020966-2302c3f0ce6c9244.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/506/format/webp)
JDK地址
![](http://upload-images.jianshu.io/upload_images/2020966-0c9d55f5170c5d7b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/960/format/webp)
JDK路径
完成之后,新建场景,保存场景,添加到build里面去切换平台为安卓Android平台
![](http://upload-images.jianshu.io/upload_images/2020966-5b726e5c926d4721.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/566/format/webp)
切换
点击Player settings修改Other Settings BundleIdentifiercom.Company.ProductName为自己的自定义的,例如:com.Test.test01,修改完成后,点击Build
![](http://upload-images.jianshu.io/upload_images/2020966-42571dbdbc7cd370.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000/format/webp)
Player settings
修改完成后,点击Build
![](http://upload-images.jianshu.io/upload_images/2020966-dd29de8ddb09d0e2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/566/format/webp)
Build
添加文件名,保存路径,保存
![](http://upload-images.jianshu.io/upload_images/2020966-769228da974e2baa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/960/format/webp)
保存
打包中……
![](http://upload-images.jianshu.io/upload_images/2020966-9f33677203ac9a9f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/566/format/webp)
打包中
打包完成
![](http://upload-images.jianshu.io/upload_images/2020966-de5cd61a7d46c33a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/829/format/webp)
打包完成
如果大家不想用手机测试,可以下一个虚拟机,我用的是蓝蝶
本文转至http://www.jianshu.com/p/3c67fbfbb67c#
作者:吐泡泡的小鲤鱼
链接:https://www.jianshu.com/p/8b94c5e12dfe
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。