在开发SDK的过程中,经常需要用蓝盾流水线构建游戏Demo测试包,主要区分Unity和Unreal Engine4引擎,下面讲解下打包的流程和常见问题。
1.Unity打包
1)使用图形界面
通用设置:Player Settings -> Android Settings -> Other Settings
其中最重要的设置如下图所示:

注意:其中Target Architectures根据你的Plugins插件支持的abi类型勾选
如果不正确的话可能出现运行时报错: Failed to load ‘libmain.so’
设置签名:Player Settings -> Android Settings -> Publishing Settings:

使用internal的方式


使用gradle的方式
在使用gradle的方式时,与internal方式不同的地方在于,internal的插件都是集成在Plugins内部的,而gradle是通过gralde脚本配置自动拉取依赖项。比如上图依赖的Android support包是在maven下载之后,将aar改成zip,将空文件夹去掉,然后将jar和so文件移动到libs目录下,然后添加project.properties(必须要有)构建的。
常见的问题:
2)使用命令进行打包
2)Unreal Engine4打包
1)使用图形界面
2)使用命令进行打包
脚本示例:
/Users/Shared/EpicGames/UE_4.26/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -project=/Volumes/ClientTest/GRobotDemo_VLink/GRobotDemo_UE4/GRobotDemo_UE4.uproject -noP4 -targetplatform=Android -cookflavor=ASTC -clientconfig=Development -serverconfig=Development -clean -package -cook -allmaps -build -stage -pak -compressed -utf8output -archive -archivedirectory=/Volumes/ClientTest/GRobotDemo_VLink/BuildResult/GRobotUE4_26/
参数说明:
-cook: cook项目,这个要勾选上,不然直接报错
注意:
1.如果构建的时候cook失败了,可以添加-IgnoreCookErrors参数,但出包后可能会出现运行时错误,最好是将cook错误解决掉;
2.之前遇到一个奇怪的问题,Android和iOS同时构建的时候没啥问题,但Android单独构建的时候,会报奇怪的cook问题,提示no moudle not found,结果发现Android的命令行脚本多了一个-nocompileeditor参数,导致Android是使用iOS构建过的缓存,但单独构建的时候没有编译compile editor,导致cook build失败了,去掉这个参数就OK了。
其它错误
1.unable to locate xcodebuild
lipo: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
lipo: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch
原因:xcode构建环境出现了问题,更新其它的版本即可。