Linux下Android手游自动编包系统的构建

 2022-02-10 08:02

论文总字数:34301字

摘 要

本文以《开心酷跑》为例,讨论了 Linux 下基于 SexyAppFramework 引擎开发的安卓手机游戏的编译、打包流程;以及如何使用 Python 和 Shell 脚本使整个流程尽可能自动化。

本文首先介绍 Linux 平台下的 SexyAppFramework 引擎和《开心酷跑》项目;接着,介绍《开心酷跑》项目中,编包工作的主要内容,及其在手游开发中的作用;然后逐一讲解编包过程中需要用到的工具,包括版本控制工具 git、游戏项目编译工具 SCons、安卓打包、解包工具 apktool、安卓调试工具 adb,以及一些常用 shell 命令。

最后使用 Python 语言编写脚本,实现包括 myapktool 图形化打包工具修改、批量编译渠道包、一键生成子包等功能,结合 shell 命令,使整个编包工作尽可能自动化,最终构建出一个自动编包系统。

关键词:手游,SexyAppFramework,Android,Linux,git,SCons,Python,shell,编译,打包,自动化

CONSTRUCT ANAUTOMATIC PACKING SYSTEM FOR ANDORID GAME DEVELOPMENT ON LINUX

Abstract

In this paper, by taking “Happy Toon Rush”as an example, we discuss the compiling and packing process of the Android games using SexyAppFramework game engine, on Linux operating system.

First of all, we’ll introduce the SexyAppFramework game engine and “Happy Toon Rush” Project. Then, we’ll talk about the main content of the compiling and packing job( let’s call it Camp;P), and the important role Camp;P played in mobile game development. After that, we will introduce the tools we need in Camp;P, including version control tool ‘git’, compiling tool ‘SCons’, Android packing tool ‘apktool’, Android debug tool ‘adb’, and other useful shell commands.

Lastly, we’ll use Python language to create a series of scripts, including the GUI packing tool ‘myapktool’, compiling all mother-packages in one time, generating all child-packages in one time, and so on. We combine Python and shell commands, to make the Camp;P as automatic as possible, and finally, we get a automatic packing system.

KEY WORDS: mobile game, SexyAppFramework,Android, Linux, git, SCons, Python, shell, compile, pack, automation

目录

Linux 下 Android 手游自动编包系统的构建 I

CONSTRUCT ANAUTOMATIC PACKING SYSTEM FOR ANDORID GAME DEVELOPMENT ON LINUX II

第一章 绪 论 1

1.1 引言 1

1.1.1 手机游戏 1

1.1.2 手机游戏产业链 1

1.1.3 编包工作 1

1.2 设计内容和设计目的 2

1.2.1 《开心酷跑》游戏简介 2

1.2.2 自动编包系统 2

1.2.3 设计目的 2

1.3 脚本代码说明 2

第二章 手动编包流程 3

2.1 版本控制工具 git 3

2.1.1 git 简介 3

2.1.2 三种状态与 git checkout/ git add 4

2.2 《开心酷跑》开发目录介绍 4

2.2.1 source 目录 4

2.2.2 android2 目录 5

2.2.3 runcool 目录 6

2.3 编译小米渠道包(母包) 7

2.3.1 母包与子包 7

2.3.2 编译工具 SCons 7

2.3.3 检查版本号 7

2.3.4 shell 脚本简介 8

2.3.5 使用 SCons 编包 8

2.4 打包小米渠道包(母包) 8

2.4.1 Android 签名证书 8

2.4.2 计费文件 9

2.4.3 渠道号 9

2.4.4 用 alias 自定义命令 9

2.4.5 用 apktool.py 打包 10

2.4.6 FusionModules2 11

2.4.7 修改默认支付方式为移动 MM 12

2.5 生成三星渠道包(子包) 12

2.6 md5sum 12

2.7 用 AxmlParserPY 进行检查 12

2.8 用 adb 进行调试 13

第三章 自动编包系统构建 14

3.1 自动化 14

3.1.1 手动编包的问题 14

3.1.2 无处不在的自动化 15

3.1.3 自动化编包系统 15

3.2 Python 15

3.2.1 基础知识 15

3.2.2 函数与对象 16

3.2.3 模块 17

3.2.4 文件 I/O 17

3.2.5 在 Python 中执行 shell 命令 18

3.3 编译自动化 18

3.3.1 版本后缀列表 18

3.3.2 用脚本编译小米渠道包 18

3.3.3 批量编译 19

3.3.3.1 setProductini 19

3.3.3.2 build 19

3.3.3.3 批量编译 mobileMM/AB 20

3.3.3.4 批量编译所有渠道母包 20

3.4 Python 处理 Excel 表格 21

3.4.1 Excel 文档 21

3.4.2 安装 openpyxl 模块 21

3.4.3 读取 Excel 文档 22

3.4.4 使用 OpenPyXL 打开 Excel 文档 22

3.4.5 从工作簿中获取表格 23

3.4.6 从表格中获取单元格 23

3.5 打包自动化 24

3.5.1 整理渠道列表 24

3.5.2 整理计费文件 24

3.5.3 myapktool 25

3.5.3.1 myconfig.py 25

3.5.3.2 使用 sys 模块获取命令行参数 25

3.5.3.3 自动填入渠道号和计费文件 26

3.5.4 打包母包 26

3.5.4.1 使用 myapktool.py 打包 26

3.5.4.2 修改默认支付方式为移动 MM 26

3.5.5 一键生成子包 27

3.5.6 自动检查脚本 checkPacks.py 28

3.6 运行测试 28

第四章 总结与展望 29

4.1 总结 29

4.2 展望 29

致谢 30

参考文献(References) 31

附录 32

第一章 绪 论

1.1 引言

1.1.1 手机游戏

手机游戏是指运行于手机上的游戏软件。随着科技的发展,现在手机的功能也越来越多,越来越强大。而手机游戏也远远不是我们印象中的什么“俄罗斯方块”“踩地雷”“贪吃蛇”之类画面简陋,规则简单的游戏,进而发展到了可以和掌上游戏机媲美,具有很强的娱乐性和交互性的复杂形态了。手机游戏的特点如下:

1. 庞大的潜在用户群:全球在使用的移动电话已经超过 10 亿部,而且这个数字每天都在不断增加。在除美国之外的各个发达国家,手机用户都比计算机用户多。手机游戏潜在的市场比其他任何平台,比如 PlayStation 和 GameBoy 都要大。

剩余内容已隐藏,请支付后下载全文,论文总字数:34301字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;