*Please sticky when finished* Unreal Engine 4 with Android HOW TO (With OBB):

Unreal Engine 4 start to finish (How to Android this place) **** Work in Progress (Simplifying Java OBB addition check stuff)****
Download UnrealEngine4 and install it following the directions here:

Programming Quick Start | Unreal Engine Documentation → Just Step One!

After the engine is installed do the following:

https://docs.unrealengine.com/latest/INT/Platforms/Android/GettingStarted/index.html

This means that your android project is ready to go for building to your android phone. (Assuming that your android device’s development mode is setup and you can find it using ADB (Android’s Debug Bridge utility).

At this point you make your project and you test it on the phone until you are ready to deploy/package it.

Ready for Packaging?

I’m going to assume that you want to package your project so you can put it up on google play store and that it will include an OBB file. So when you package your game you will have the *.apk and the *.OBB file.
Step One) before packaging the android version of your game you need to create your Keystore and set it up so that the keystore gets auto applied to your UE4 Android Package (So it gets signed).

Basically, you do this: (Per KillerSneak on the forums) [How to sign a APK file - Android Development - Unreal Engine Forums]

Make a key:

keytool -genkey -v -keystore C:\Users\YourUserName\YourAppName.keystore -alias YourAppName -keyalg RSA -keysize 2048 -validity 10000
Change YOURUSERNAME to your windows username
Change YOURAPPNAME to your app/game name
Then in

  1. C:\Users\YourUserName\Documents\Unreal Projects\YourAppName\Build\Android

open the file SigningConfig.xml
<keyalias>Same as key alias above so YourAppName</keyalias>
<keystore>full path to keystore file from above - C:\Users\YourUserName\YourAppName.keystore</keystore>
<keystorepassword>made above during the generation of your key</keystorepassword>
<keypassword>sameaskeystore</keypassword>
This is it. This way you will sign your APK file so you can upload it to the Google Play Store and it will be signed.

To read your keyfile:

keytool -list -v -keystore C:\Users\YourUserName\YourAppName.keystore

To zipalign your APK:

It is recommended that you zipalign the final APK package with zipalign by doing this:
zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk

To verify your APK was signed:

jarsigner -verify -verbose -certs C:\PathToAPK\YourAppName.apk

In your UE4 project you have to ensure the following settings are set as intended:

https://docs.unrealengine.com/latest/INT/Platforms/Android/GettingStarted/5/index.html

Feel free to choose any of the Android Package Configuration Options

https://docs.unrealengine.com/latest/INT/Platforms/Android/Reference/index.html

I have been choosing (ETC1) (All images get compressed except for with transparency like .PNG image files)

Now when this is finished in your installation directory you will have either situation ( A .BAT file with an .APK file ) OR ( A .BAT file with an .APK file and an .OBB file)

If you have just the .BAT file and the .APK file and the .APK file is under fifty (50) Megs then you can just upload it to the Developer Portal on Android’s site (developer.android.com) and you’re good to go.

If, however, you have the .BAT file with an .APK file and an .OBB file then you need to do the following steps:
****** THIS IS A WORK IN PROGRESS ******
Side Note: I have an .OBB file in my build and by the third revision (3) it auto downloaded every time I tried it, even on new phones. So if that doesn’t happen for you keep reading about how to make a downloader service and add it to your Android project. If you would like to complete it just post the rest of the answer and I’ll put it in here.

You need to make sure the .OBB file is uploaded when you upload the .APK file and you need to make sure the application knows to check to ensure that it has its .OBB file installed on the phone/tablet device and if not to go download it so it is before starting the game.

Basically the high level jist of this concept is as follows:

The download process from a high level looks like this:

  1. User selects to install your app from Google Play.
  2. If Google Play is able to download the expansion files (which is the case for most devices), it downloads them along with the APK.
    If Google Play is unable to download the expansion files, it downloads the APK only.
  3. When the user launches your application, your app must check whether the expansion files are already saved on the device.
  4. If yes, your app is ready to go.
  5. If no, your app must download the expansion files over HTTP from Google Play. Your app must send a request to the Google Play client using the Google Play’s Application Licensing service, which responds with the name, file size, and URL for each expansion file. With this information, you then download the files and save them to the proper storage location.
    Caution: It is critical that you include the necessary code to download the expansion files from Google Play in the event that the files are not already on the device when your application starts. As discussed in the following section about Downloading the Expansion Files, we’ve made a library available to you that greatly simplifies this process and performs the download from a service with a minimal amount of code from you.
    The basic logic you need to download your expansion files is the following:
  6. When your application starts, look for the expansion files on the shared storage location (in the Android/obb/<package-name>/ directory).
    a. If the expansion files are there, you’re all set and your application can continue.
    b. If the expansion files are not there:
  7. Perform a request using Google Play’s Application Licensing to get your app’s expansion file names, sizes, and URLs.
  8. Use the URLs provided by Google Play to download the expansion files and save the expansion files. You must save the files to the shared storage location (Android/obb/<package-name>/) and use the exact file name provided by Google Play’s response.
    Note: The URL that Google Play provides for your expansion files is unique for every download and each one expires shortly after it is given to your application.

If your OBB file isn’t automatically getting downloaded then you may need to implement the downloader add-on to your application here are some links that talk about that:

No matter which guide you follow you will need a couple of things on hand from your project:

[VersionCode] from your Android Manifest
[YourLVLKey] from your publisher account for the application
[SALT] a set of random numbers used to obsfucate your key here is an example = new byte] { 1, 42, -12, -1, 54, 98,
-100, -12, 43, 2, -8, -4, 9, 5, -106, -107, -33, 45, -1, 84}
[mainFile] exact name of the .OBB file
[MainFileSize] the exact size of the .OBB file in bytes

So, Lets assume that you have to add a downloader checker service and your here still reading.
First things first, you need a couple of libraries in order to get this process started. To get these libraries just do this:
Go here and download the Eclipse ADT with the Android SDK for Windows
http://developer.android.com/sdk/index.html [Its a blue button with white lettering]

Extract it to your preferred location, and then open the extracted files until you see the [SDK Manager.exe]
Open up the [SDK Manager.exe]
Scroll to the bottom of it and expand Extras.
In extras checkbox the [Google Play Licensing Library] and the [Google Play APK Expansion Library] and click install packages. Agree to the terms etc until its installed.
After the downloads are complete you can close out the Android SDK Manager as you won’t be needing it for right now.

In the extracted files that you had open, look for the folder named SDK and open that. Then open → extras\google
There you should see the two libraries you downloaded earlier the play_apk_expansion and the play_licensing.
In each of these folders are the folder you are looking for IE:
play_apk_expansion → downloader_library
play_licensing → library

You will need those in a moment but open up a new window and navigate to the folder that corresponds with your engine in the engine install directory
Mine is as follows: (I use 4.4, and I installed it on my E drive for this example)
E:\Program Files\Unreal Engine\4.4\Engine\Build\Android\Java
Copy and paste the downloader_library and the library folders here.

Then navigate to this folder:
E:\Program Files\Unreal Engine\4.4\Engine\Build\Android\Java\src\com\epicgames\ue4

In this folder are the files that get copied to your android directory before you build it so if you modify these files they will modify the files for all of your android projects. If you are implementing a download checker this is the place you would want to do it at.

Open the file [GameActivity.java] in your favorite editor, I’ve been using Notepad++ but you can use whatever

That is it for now. I will continue it when I get a moment.

Please sticky when finished* Unreal Engine 4 with Android HOW TO (With OBB):

Thanks You :cool:

The downloader service is already added with the 4.8/4.9 engine versions. Still nice documentation.

Great tutorial thanks a lot .

Thanks for sharing this tutorial :cool:

Yeah helpful tutorial thanks a lot :slight_smile: .