前言:
本教程适用于UE4.26。文章最后部分有常见问题解决与性能优化。
教程开始:
![](https://img-blog.csdnimg.cn/img_convert/c7d82d6018374e5edf93c5cd7b592390.webp?x-oss-process=image/format,png)
2.打开Android Studio(if启动时提示access SDK错误,点Cancel即可继续)--等待下载完成
![](https://img-blog.csdnimg.cn/img_convert/287fbe866196f72ff777fc943bd8ae8b.webp?x-oss-process=image/format,png)
点击Customize--All setting进入Setting For New Projects
![](https://img-blog.csdnimg.cn/img_convert/fc2612683fd5ca4ab6ace0d03524bcfe.webp?x-oss-process=image/format,png)
![](https://img-blog.csdnimg.cn/img_convert/9bc65501dabf9e4379154892a883d988.webp?x-oss-process=image/format,png)
展开System Settings--Android SDK勾选4.4以上的任一个和NDK21.1.6352462下载
(点击Show Package Detail可找到NDK)
![](https://img-blog.csdnimg.cn/img_convert/44ce2f341ded56d51aaeadd746b679bf.webp?x-oss-process=image/format,png)
![](https://img-blog.csdnimg.cn/img_convert/804bb7ebadeb23a52dda1c7febe6d27a.webp?x-oss-process=image/format,png)
点击OK确认下载清单,Accept后Next等待下载完毕,Finish后关闭安卓Studio
![](https://img-blog.csdnimg.cn/img_convert/b5c1713660064d49ac6f4f9a1ec4596e.webp?x-oss-process=image/format,png)
![](https://img-blog.csdnimg.cn/img_convert/aad68a74441e704fbab7465954ae0ecb.webp?x-oss-process=image/format,png)
4.记住对应的SDK目录,UE等会会用到
![](https://img-blog.csdnimg.cn/img_convert/52bd78a680cd875305ce724f767e7fc3.webp?x-oss-process=image/format,png)
打开UE项目-项目设置-Android SDK-设置你的对应路径
![](https://img-blog.csdnimg.cn/img_convert/26073ea98ec4fefd27b5ff5a529f7204.webp?x-oss-process=image/format,png)
打开项目设置-Android-接受SDK证书-立即配置-
设置你的项目包名,勾选将数据打包至.apk中?,目标SDK版本填25
设置游戏默认地图,项目图标,启动画面..........
5.所有相关自定义设置完成后开始打包ETC2
注意:
1.打包如果卡在这一步十分钟以上,请开启科学上网(一劳永逸)
(包大小约200MB,也可直接第2步去手动下载解压)
![](https://img-blog.csdnimg.cn/img_convert/38251fe4b0046bae0321b7490d12141f.webp?x-oss-process=image/format,png)
2.如果出现Gradle错误打包失败,请手动下载以下目录版本的压缩包替换到对应路径(错误是程序解压失败)并手动解压到对应的文件夹(gradle-x.x.x)中覆盖
![](https://img-blog.csdnimg.cn/img_convert/77610dc120b29669d788f87643396807.webp?x-oss-process=image/format,png)
3.错误提示重装SDK Manager其实是Build Tools工具需要下载对应版本,如这里是32.0.0
![](https://img-blog.csdnimg.cn/img_convert/26816371a509d7245a19a887c5c64987.webp?x-oss-process=image/format,png)
进入路径复制d8.bat改为dx.bat & 复制d8.jar改为dx.jar再打包即可
![](https://img-blog.csdnimg.cn/img_convert/bc6cd71fdf302c753a9b07883175508d.webp?x-oss-process=image/format,png)
复制d8.bat改为dx.bat
![](https://img-blog.csdnimg.cn/img_convert/7bf2435ee092a1636aac672dc0c2b49e.webp?x-oss-process=image/format,png)
复制d8.jar改为dx.jar
4.if一台安卓闪退另一台正常运行时,请注意设备是armv7还是armv64,也可以都勾选但会增加打包时间与容量,勾选支持Vulkan的安卓设备Vulkan渲染技术会充分利用
![](https://img-blog.csdnimg.cn/img_convert/d5e5998007b3b9cc52bb0b5a3bfc5d96.webp?x-oss-process=image/format,png)
5.安卓设备性能有限,可做如下设置提高安卓端性能:(大幅降低画面质量)
(目标硬件移动设备,渲染质量可缩放3D/2D)
![](https://img-blog.csdnimg.cn/img_convert/d9f393d955fb204a5359303b6868ec1c.webp?x-oss-process=image/format,png)
编辑器中视口预览安卓端效果请选择预览ES3.1(需重启项目编译着色器)
![](https://img-blog.csdnimg.cn/img_convert/2fa7181c8bcf3e7fb9a5c21456d9d04c.webp?x-oss-process=image/format,png)
开启前向着色
![](https://img-blog.csdnimg.cn/img_convert/dfe19c58897a57f723b46c56d3123d3f.webp?x-oss-process=image/format,png)
移动MSAA 4x MSAA