BuildCommand.Execute: ERROR: BUILD FAILED
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): Program.Main: ERROR: AutomationTool terminated with exception:
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): Program.Main: ERROR: Exception in UnrealBuildTool: ERROR: DistributionSigning settings are not all set. Check the DistributionSettings section in the Andriod tab of Project Settings
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): Stacktrace: at UnrealBuildTool.Android.UEDeployAndroid.PrepareToSignApk(String BuildPath)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at UnrealBuildTool.Android.UEDeployAndroid.MakeApk(String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at UnrealBuildTool.Android.UEDeployAndroid.PrepForUATPackageOrDeploy(String ProjectName, String ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bIsDataDeploy)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at AndroidPlatform.Package(ProjectParams Params, DeploymentContext SC, Int32 WorkingCL)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at Project.Package(ProjectParams Params, Int32 WorkingCL)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at BuildCookRun.DoBuildCookRun(ProjectParams Params)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at BuildCommand.Exe
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): cute()
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at AutomationTool.Automation.Process(String[] CommandLine)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at AutomationTool.Program.MainProc(Object Param)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at AutomationTool.InternalUtils.RunSingleInstance(Action`1 Main, Object Param)
MainFrameActions: Packaging (Android (Multi:ASTC,ATC,PVRTC,DXT,ETC2,ETC1)): at AutomationTool.Program.Main()
出现这个问题可能有两种原因:
1,没有生成.keystore文件
如果你是准备打包单个apk文件(packing setting里面勾选了“For Distribution”),那么需要设置google play services。如果只是开发阶段,建议直接用development模式,不勾选For Distribution,缺点就是安装apk时必须把设备通过usb链接到开发机上安装。另外我发现我的android设备上安装development版本时,必须安装带obb文件的版本,NoOBBInstall版本启动不了游戏,这个可能是我设备问题
国内开发者设置google play非常麻烦,某宝上卖开发者账号的骗子也不少,账号对应的信用卡关联过其他开发者账号,这个不符合google的策略(封号的策略条款很多,自己搜索下),会永久性封号,所以大家小心点,如果是等级很低的店铺最好不要买,新闻说预计2016年google会出一个国内版本的google play。当有了一个开通后的开发者账号之后,接着google play的设置方法如下:
https://forums.unrealengine.com/showthread.php?21803-Google-Play-Setup
Here’s a basic write-up of the steps to set up a game for Google Play, YMMV.
On Google Play, apps and game services are separate entities. It’s possible to link one game service to multiple apps, which is useful for cross-platform games that utilize Google Play services (note, UE4 only supports Google Play on Android currently). This complicates the process of getting a game set up a bit, but hopefully this guide will help.
To set up a game service for an Android app:
- Sign in to the Google Play Developer console and add your game.
Most people will need use the “I don’t use any Google APIs in my game yet” tab.
In the “game details” form, you only need to fill out the display name for testing, but the rest will need to be added before you can publish. - Link your app to your game service
Click “Link an Android app”, follow the prompts, and fill out the information.
Click “Authorize your app now” to… - Create a client ID
Fill in the information and click “Continue”
Enter the package name of your app
Enter the SHA1 fingerprint of the certificate you use to sign your APK. With the Android SDK installed, you can find this by running the following command:
Code:keytool -exportcert -alias <your-key-name> -keystore <path-to-production-keystore> -list -v
Code:keytool -exportcert -alias androiddebugkey -keystore C:\Users\Your.Username\.android\debug.keystore -list -v
If the “For distribution” box is checked, UE4 will use the information in SigningConfig.xml to sign the APK, so you’ll need to use those values to get your deployment fingerprint. You will probably want to test Google Play functionality with both debug and distribution builds. To do this you link another app from the Developer Console, using the same package name you used the first time, but if you used the debug fingerprint before, use the distribution fingerprint this time, and vice-versa. Make sure you go through the “Link another app” button to do this. If you add the second client ID directly from the Google API console, it won’t work with Google Play services. - To test Google Play features before publishing your app, you need to add Google accounts to the list of accounts with testing access. You can manage this list under the “Game services” -> “Testing” menu for your app in the Google developer console. Any accounts listed here should be able to sign in to Google Play in your app before the app is published.
- You need to enter some information about your game in the Unreal Editor. Make sure your project is configured for the Android platform and Google Play Services in the project settings. Once it is, check “Enable Google Play support”.
- You also need to tell Unreal about your game’s Google App ID. This is the number in the heading next to your game’s name in the Developer Console. Enter this number in the “Games App ID” field of the Android platform settings.
- Fill out your game’s information – add achievements and leaderboards in the developer console. For each leaderboard and achievement you add, Google will generate an ID that looks like a string of random characters. In order for UE4 to correlate the more friendly, cross-platform names to the Google IDs, you have to define a mapping for your game. Fill in the “Achievement Map” and “Leaderboard Map” fields in the settings.
- Implement and test your game, and when you’re ready to publish, you’ll need to publish both the game service and the Android app. Publish the game service first, otherwise, if users download your app before the game service is published, they won’t be able to sign in to Google Play.
如果不设置google play,至少也得生成.keystore文件
https://forums.unrealengine.com/showthread.php?65516-Packaging-for-Android-in-Shipping-mode-fails
Build successful in Shipping mode! I had to create the .keystore file.
Having NVPACK installed from Epic Games\[Engine version]\Engine\Extras\Android\tadp-2.0r8-windows.exe I had to open cmd.exe and to write the command:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
I just had to replace my-release-key and alias_name with the names I needed.
After that I followed every appeared step and the .keystore file was created.
The created .keystore file (the directory was written after creation) I copied in My_project\Build\Android
After I copied the .keystore file I filled the boxes in Project Settings>Android>Distribution Signing
And finally Build has been successful.
3,UE4 Editor自身的bug
如果没有勾选““For Distribution””,或者勾选了且google play services设置正确了仍然存在这个问题,可能是UE4的bug,两个官方论坛帖子都说重新建个新工程然后把文件拷过去就好了;另外,貌似和操作系统有关,出问题是windows8.1,我的是windows10,建议ue4开发用windows7。另外建议勾选 Packaging Settings中的Full Rebuild,保证每次构建时都清理一次全部重编:
https://answers.unrealengine.com/questions/200344/packaging-failed-cant-package-473.html
https://answers.unrealengine.com/questions/199457/cooking-and-packaging-project-stuck.html
之前遇到过GameMode没有生效的问题,进游戏时是系统默认的自由摄像机,后来把地图删掉重建了一个,自定义GameMode才生效