- # How To Sign UE4 Android Package
- # Contents
- # 1. GO TO PROJECT SETTINGS
- # 2. UPDATE YOUR «PACKAGING» SETTINGS
- # 3. FILL IN YOUR «DISTRIBUTION SIGNING» SETTINGS
- # 4. CREATE YOUR SIGNING KEY (.keystore file)
- # 5. VERIFY .keystore FILE CREATION AND TEST PACKAGING FOR ANDROID (SHIPPING)
- Shipping With Android
- Getting your UE4 powered game setup on the Google Play store.
- Google Play Console
- Google Play Store Listing
- Google Play Store APK Size
- Google Play Console API Changes
- Project SDK Override
- Android SDK Version
- Shipping with Multiple Expansion Files
# How To Sign UE4 Android Package
Here’s a step-by-step guide to «signing» an Unreal 4 Android app (.apk file) for distribution (e.g. for release on Google Play or through other channels).
This distribution signing process is required for submitting apps to Google Play, and (in my experience) for .apk apps to run on everyday Android devices that do not have Developer Mode enabled, regardless of where the app is downloaded from.
When I needed to package an app for non-developer testing and shipping, I had to piece this process together from snippets on various help forums; this page aims to run through the whole process in one place.
These instructions are current as of version 4.12.3.
# Contents
# 1. GO TO PROJECT SETTINGS
Start by opening the Unreal project you want to sign. Open the «Project Settings» menu by clicking the Settings icon and selecting Project Settings from the dropdown, or going to Edit > Project Settings.
There are two Settings sections you’ll be working with here.
# 2. UPDATE YOUR «PACKAGING» SETTINGS
First, find and click to «Packaging» section under the «Project» header (near the top of the left-side list of Settings sections).
Go ahead and check the «For distribution» box. This will automatically set the Unreal packaging process to output a Shipping build (instead of Development build) the next time you run it.
. BUT if you try to package now, you’ll very likely get an error and build failure, because you haven’t signed the package yet.
# 3. FILL IN YOUR «DISTRIBUTION SIGNING» SETTINGS
Next, go to the other Settings section relevant to distribution signing: the «Android» section under «Platforms» (found near the bottom of the left-side settings list).
Within the Android section, there’s a set of options titled «Distribution Signing,» with four form fields:
These fields (at least the first 3) need to be filled in with text that corresponds to the distribution signing «key» you’re going to create in the next step.
a.) Key Store: this is the name of the signing key file you’re about to create. This name MUST end with «.keystore» (that’s the file type of the key file), but beyond that you can pick whatever name you want. So, for example.
As long as it’s in the format [YourCustomKeyName].keystore, Unreal should be able to find the file path during packaging.
b.) Alias: as far as I can tell, this is exactly what it sounds like — an alternate name for the signing key you’ll create that’ll help you easily recognize / identify it later on. Again, whatever you like. «MyGame» would be fine.
c.) Key Store Password: A general password for accessing any .keystore files you create. If you’ve never created a .keystore file or used the command line «keytool» for anything else, enter whatever you want here. If you have, enter the password you’ve used before.
d.) Key Password: A specific password for accessing THIS specific signing key (i.e. this specific .keystore file). YOU CAN LEAVE THIS BLANK if you just want to use the general keystore password you typed above.
So, after filling in each of those items, your Distribution Signing settings should look something like this:
# 4. CREATE YOUR SIGNING KEY (.keystore file)
The final step is to create the actual .keystore file using your computer’s command line. (You’ll sometimes see Android documentation refer to this as «manually creating» your signing key.)
IMPORTANT NOTE: Some of the older Unreal help threads on this topic tell you to copy in and/or modify a preexisting SigningConfig.xml file. This is no longer necessary! Don’t go looking for that file, you won’t find it in your project folder or Unreal’s general Engine folders.
— Open a command line window. (In Windows, the easiest way to do this is hit the ‘Windows’ symbol key, type «cmd,» and then hit ‘Enter’ or choose the «Command Prompt» program option that pops up. I haven’t tested this process on a Mac, but using the same commands in Terminal should be pretty similar.)
— Now, in the command line window, you need to navigate to the subfolder in your Unreal project called «Builds/Android». If you can find that folder in your actual file browser (e.g. Windows Explorer) project files, you can just type «cd » (include that space) in the command window and then drag and drop the folder in — the Command Prompt will convert it to a file path, and hitting enter in the command line should put you inside that folder. For example:
cd «C:\Users\Me\Documents\Unreal Projects\MyGame\Android\Builds»
(If you’ve never packaged or launched your project for Android before, you may not have a «Builds» folder or the «Android» folder inside it. but just creating them now should work fine.)
— Once you’re in the right folder in the Command window, the final step is to type in the command that will create the .keystore file with all the necessary data.
The one CRUCIAL THING here is to make sure that the details you type when creating the file match what you entered in your Unreal Distribution Signing settings (Step 3 above). If you get something wrong, you’ll have to go back to the settings and change the information there to match whatever you actually created in the .keystore file.
So if I were using the same info I entered in Step 3 above, I’d type:
keytool -genkey -v -keystore MyGame-key.keystore -alias MyGame -keyalg RSA -keysize 2048 -validity 10000
Or, the same command with the parts you should change to your own specific settings in brackets:
keytool -genkey -v -keystore [YourKeystoreFileName.keystore] -alias [YourAlias] -keyalg RSA -keysize 2048 -validity 10000
(This follows the instructions under «Sign your App Manually» at the very bottom of this page: https://developer.android.com/studio/publish/app-signing.html#releasemode
— Hit «Enter,» and you’ll be prompted to «Enter keystore password.» Here you should enter EXACTLY the same «Key Store Password» you typed into your Unreal settings («xxxxxx» in my case). You’ll be prompted to re-enter the password to confirm it.
You’ll then get a series of questions requesting identifying information. Most of these are pretty straightforward (name, etc). I generally typed what was requested, or hit «enter» to leave a field blank (skipping fields this way didn’t seem to cause any problems with signing, but I can’t guarantee that it won’t).
At the end of this list, you’ll have the option of entering a password for this specific key. If you just want to use your general Key Store Password, hit ‘Enter.’ If you also want a specific password for this .keystore file, again enter exactly what you typed in the 4th/last field of your Unreal Distribution Signing settings.
And. that’s it! The final output you should see from the Command Prompt is a rundown of the data for the .keystore file you just created. If you want to be extra-safe, screenshot this line so that you have this information on file, in case there were any typos or mismatches with what you entered in the Unreal settings.
# 5. VERIFY .keystore FILE CREATION AND TEST PACKAGING FOR ANDROID (SHIPPING)
To verify that your distribution signing key was created, you can go to your Android/Builds folder within your project. You should see the «MyProject-key.keystore» in there. If it’s not, something went wrong.
And now, when you go to File > Package Project > Android within the Unreal Editor, and then watch the build log, you will see, toward the end, that Unreal checks for the signing file.
If you still get an error at that stage of the build process, it is most likely because there is a mismatch between the filename or data in your actual .keystore file and what you entered in the Unreal Distribution Signing settings. Go back and check what you entered when you created the .keystore file in the command line (this is why screenshotting the final record is helpful). If anything doesn’t match, change your Unreal settings to the correct text.
Источник
Shipping With Android
Getting your UE4 powered game setup on the Google Play store.
Once you have completed building your Unreal Engine 4 (UE4) powered mobile project, the next step is getting it ready to be distributed through the Google Play store. In the following document, we will take a look at some of the various items that could cause issues when getting your UE4 project on the Google Play store.
The Google Play store changes its look, layout, and workflows on a regular basis without any prior notification. Because of this, some of the information in this guide might be in a different location, use a different name or been removed completely. Make sure to check the official Google Play Store help pages should you not be able to find the information you are looking for, or if the information you found is out of date.
Google Play Console
The Google Play Console is the web portal that is used to upload, manage and release your UE4 project on the Google Play Store. From the Google Play Console, you can do a wide range of tasks, like configuring your project for release to running automated tests. You can track how you are acquiring new users or how well your UE4 project is performing across a wide range of Android capable hardware.
Google Play Store Listing
Before your project can be displayed and downloaded from the Google Play Store, you will need to first fill out all of the various sections that have a grayed out checkmark box in theВ DashboardВ section of the Google Play Console.
Make sure to read each section carefully and provide the needed information and files.
Once you have successfully completed a section the grayed out checkmark box will change to green like in the following image:
Once each of the required sections in the Dashboard has a green checkmark next to it, your application is then ready to be reviewed by Google for release on the Google Play Store.
Google Play Store APK Size
The Google Play Store has a size limit of 100 MB for any APK that is uploaded. If your application requires more data than can fit in the 100 MB limit, you will have to place the rest of the content into an Opaque binary blob(OBB)file. The maximum size for an OBB is 2 GB. Once you have uploaded your UE4 APK to the Google Play Console, it can take at least 45 minutes or more until you will be able to push the APK into Alpha, Beta or Release. Because of this, it is common practice to complete App Releases section first and then fill out the rest of the needed information.
Google Play Console API Changes
Google Play will require that new apps target at least Android 8.0 (API level 26) from August 1, 2018, and that app updates target Android 8.0 from November 1, 2018. UE4 version 4.21 or newer will take this into account but any project made with previous versions of UE4 will have to be updated to accommodate for this new change.
This new change will require that your UE4 project ask the user for permissions to utilize certain features of the OS, like writing a save file to disk, when it is time to do so. In the past, the user was asked to grant all needed permissions when the application was first to run. В To help you manage the requesting of permission in UE4, versionВ 4.21 (and later),В you will need to use the Android Runtime PermissionВ Plugin that can be found in the Android section of the Plugins menu.
Click for full image.
Project SDK Override
The Project SDK Override enablesВ you to change, on a per project basis, which version of the Android SDK’s are used to compile your project. You can find these options by going to Project Settings > Android > Project SDK Override.
Click for full image.
Android Setting
Description
SDK API Level
Controls the Java API used to compile the Java portion of the engine code.
NDK API Level
Controls the compiler toolchain that the C++ code complies with. This may restrict the version of Android your native code will be compatible with.
Leaving the fields blank will use the global Android SDK project settings.
Android SDK Version
The AndroidВ Minimum SDK VersionВ input helps determine the minimum OS version that your app can be installed on. The Target SDK Version informs the Android OS of the expected behavior of the API. If you are not sure which SDK Version is used with which Android OS, check out the Codenames, Tags, and Build Numbers page for more information.
Click for full image.
Setting
Description
Minimum SDK Version
This controls the minimum OS version that an app can be installed on. This is also used by the Google Play Store to filter which devices your application is seen by in the store.
Target SDK Version
This informs the Android OS of the expected behavior of the API. В Setting this to a particular API level is a promise that your code will work with the features and changes introduced by that Android release.
If you have a project that is using an older version of UE4 and you want to ship to Google Play store, you will need to set your Target SDK to 26. This will still allow your app to run on older devices that might not have Android SDK 26 as long as the Minimum SDK Version is sufficient.
Shipping with Multiple Expansion Files
The Unreal Engine automatically packages the contents of the Content folder into separate OBB expansion files when you package your project for Android. When publishing an application to the Google Play Store that uses multiple OBB files, follow the steps below to ensure that your OBBs are uploaded correctly alongside your project’s APK:
Start a new Alpha track by pressing the Create Release button.
Press the Browse Files button to upload your APKs. You should upload your Arm7 first, then your Arm64 second.
Once the upload is complete, press the Plus icon located next to the word REMOVE to add your OBB file.
From the OBB Menu, click the drop-down next to the No Expansion File option and from the displayed list, select the Upload a New File option.
Using the displayed dialog box, navigate to the OBB that matches the APK store version and press the Okay button.
If you are not sure what APK store version you should use, you can open your BAT files with a text editor to see which version your project is using.
Once the OBB has been uploaded, you will see it in the Use Expansion File box. Press the Save buitton.
When uploading an OBB file output with UE version 4.22 or earlier, you may receive a warning indicating that the file you have uploaded is identical to an earlier one, as in the above image. This can occur if the OBB file that you are using has the same size in bytes as an OBB from a previous build that you have uploaded. However, the OBBs are not actually identical, and if you select earlier OBBs then it will result in errors when attempting to run the application. Ignore this warning and upload the OBBs output with your build as normal.
If you are using UE version 4.23 or later, this issue is resolved and the upload dialogue will not erroneously report OBBs as being identical.
Repeat the above steps for any additional OBB files you might have.
Источник