Unreal Engine02:打包安卓apk和部署

本文详细介绍了如何在不使用AndroidStudio的情况下,为UE4.24版本配置安卓开发环境,包括安装AndroidCodeworks组件和设置项目参数。同时,文章还讲解了如何减小UE4项目打包成APK的大小,并提供了打包流程及部署到安卓手机的方法,适合希望避免使用AndroidStudio且关注APK瘦身的开发者参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

写在前面

本文主要介绍如何为UE4配置安卓开发环境以及如何将UE4项目打包成安卓apk并部署的过程。

一、配置安卓开发环境

主要参考了博客:UE4 C++学习笔记之番外篇:Android打包基础

  • 值得注意的是,在UE4.25及以上版本中,官方均推荐使用Android Studio来配置安卓环境。但由于Google被墙而且Android Studio过于臃肿的原因,个人其实并不是很想用Android Studio来进行配置。

  • 所以如果是像在Unreal Engine01:环境配置一文中那样安装了UE4.24版本,可以采用下面的方式来进行安卓环境的配置,不需要使用Android Studio。

  • 但如果是想要配置Android Studio的,也可以参考这篇博文:UE4.24版本使用AndroidStudio配置打包环境

1.安装Android Codeworks相关组件。

  • 找到虚幻引擎安装目录,打开Engine\Extras\AndroidWorks\Win64文件夹,使用CodeWorks forAndroid安装程序来安装Android内部的Codeworks版本。
  • 安装Codeworks的时候,两个文件夹NVDIANVPACK可以放在C盘以外的地方(个人推荐也是如此,可以节省C盘空间)。
  • 有些安装包会因为Google被墙的缘故而下载失败。此时查看NVPACK\local.ini文件,直接搜索下载错误而缺失的组件名,找到它的下载链接,在浏览器中打开下载。如果该链接仍然下载不了,把链接中的"-ssl"删除之后即可下载。下载好的压缩包都放在NVIDIA\CodeWorksforAndroid下。最后重启Codeworks安装程序即可。

2.配置项目设置。

  • 按照下面图片中的设置即可。
  • 记得接受SDK证书。
  • 如果安装包名称和应用显示名称不设置,默认会用项目名代替。
  • 密钥的部分可以自己随意设置。
  • 注意两个绿色框都要是绿色才行。

配置安卓项目环境
配置安卓项目环境

二、打包安卓APK

这一步主要是要考虑如何尽量减少打包的文件,以减少最后的apk大小。可以参考官方文档:https://docs.unrealengine.com/5.0/zh-CN/setting-up-unreal-engine-projects-for-android-development/

1.设置目标硬件

  • 这一步很重要,如果目标硬件是在PC上的,那么打包的apk将十分臃肿(实测轻松超过1G)。所以必须要将平台改为在移动设备上。

选择目标硬件

  • 一种设置方式是在创建项目的时候选择目标硬件是移动设备/平板电脑

选择目标硬件

  • 但如果在创建项目的时候设置了目标硬件是桌面,也不用担心,可以用另一种方式,也就是在项目设置中进行修改。

修改目标硬件

2.其他减少apk的项目设置可以参考官方的文档:https://docs.unrealengine.com/4.26/zh-CN/SharingAndReleasing/Mobile/Android/ReducingAPKSize/

  • 主要可以设置下面几项。
  • 注意有些设置项显示不全,需要在右上角开启。

设置减少打包文件

设置点光源

3.选择打包的格式。

  • 点击文件->打包项目->Android进行打包。

打包安卓apk

  • 各种格式打包出来的apk的大小也有一些不同。最小的apk可以选择ETC2进行打包。

不同的格式对应的apk大小对比

  • 打包的路径一般是选择在Build中新建一个文件夹。

打包路径

三、部署到手机

找一台安卓手机,把打包好的apk传到手机上,然后安装即可运行。

Tap into the power of Unreal Engine 4 and create exciting games for the Android platform About This Book Dive straight into making fully functional Android games with this hands-on guide Learn about the entire Android pipeline, from game creation to game submission Use Unreal Engine 4 to create a first-person puzzle game Who This Book Is For If you are a game developer, designer, artist, or a beginner in the gaming industry and want to make Android games with Unreal Engine 4 efficiently, this book is ideal for you. In Detail Have you ever wanted to create games that will get users hooked to their phones? Unreal Engine 4, with all its tools and power, will help make your dreams come true! Designed to get you working with Unreal Engine 4 from the very first page, this book will quickly guide you through the basics in the first two chapters. Once you get the hang of things, we will start developing our game―Bloques! Bloques is a puzzle game with four rooms. Each room will be more challenging than the previous, and as you develop, you will graduate from movement and character control to AI and spawning. Once you've created the game, you will learn how to port and publish your game to the Google Play Store. In addition to building an Android game from start to finish, you will also discover how to generate revenue, and how to optimize game performance using the tools and functionalities the engine provides. With this book, you will be inspired to come up with your own great ideas for your future game development projects. Table of Contents Chapter 1. Getting Started with Unreal 4 Chapter 2. Launching Unreal Engine 4 Chapter 3. Building the Game – First Steps Chapter 4. Using Actors, Classes, and Volumes Chapter 4.X folders Chapter 5. Scripting with Blueprints Chapter 6. Using Unreal Matinee Chapter 7. Finishing, Packaging, and Publishing the Game
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值