When I found myself having to split an android application (APK file) to allow it to be uploaded onto the Google Play store, I found a serious lack of current information and much misdirection possibly due to the recent changes within Unity and the actual Play store itself.

So here is a rough guide that works with unity 4.3 or up, in this example I am only catering for devices running android 4.0 ICS or up ( API level 16), not quite sure what to do with earlier Android API versions at this very moment.

STEP -1

Firstly ignore the asset store OBB plug-in  (it was created for earlier versions of unity, or possibly for catering for earlier Android API’s) going down this route will burn hours of your life.

STEP  1

If you haven’t done so already go to EDIT>PROJECT SETTINGS>PLAYER SETTINGS select the android role out and go to the PUBLISHING SETTINGS roll-out and do the following:-

1) Create a new keystore by selecting a keystore name and password (confirm the password)
2) Select “Create a new key” under Key Alias
3) A new window opens; enter the necessary information.
4) Select the newly created key.

n.b. Remember the passwords; they are not stored with the project (for security reasons), every time you load the project you will need to enter this password from now on.

5) Tick Split Application Binary at the bottom of this roll out!

STEP 2

Again if you haven’t already done so create a primary loading scene with very little content, this will allow unity to split most of your app data off to the OBB data/zip file and keep the APK file size small. As an example I created a scene called Android Loader, so that I could exclude when I build the same project for IOS, I also put a tiny script in there to load the first real app scene/level which would be in the split OBB, this could be as simple as:-

Application.LoadLevel(“NameOfYourFirstAppScene);

However to expand on that I used the below, if you have Streaming Asset folder files to move (see my other post re:- vuforia) :-

 STEP 3

When your done with your scene loader and happy with your app, build the android split apk, it will create two files:-

YourAPKName.apk and YourAPKName.main.obb

Rename the .obb file only to main. (your version number from settings) . (your bundle identifier i.e: com.companyname.appname) . obb

For instance lets say my version number was 4 and and bundle name was com.jonmartinmedia.game my obb file name became:

main.4.com.jonmartinmedia.game.obb

STEP 4

Upload to google play as an Alpha tester (don’t miss this step!), you will need to set yourself up as an alpha tester (follow other instructions for this as otherwise this tutorial would be very very long indeed), the google play developer console will allow you to upload an apk, go ahead and do this, afterwards it should ask you if you want upload and .obb expansion file etc.. however if it doesn’t re-upload the apk for a second time then it will give you the option after the apk is uploaded for the second time.

After you have successfully uploaded your apk and obb file, you can download to your android test device after a short wait (delete any old test versions and install using the alpha testing account (again follow google play instructions for this)).

STEP 5

Hopefully if all is well,and you’ve tested on your device, you can then promote the alpha version to a published version in developer console, and make it all live!

However:

You may want to make some adjustments to the app, so rather than upload a new split apk version every time you can now, just replace the obb manually located on the android device in Android/obb/YOURBUNDLEID/main.VER.YOURBUNDLEID.obb being sure your obb name is renamed exactly the same and then copy the apk file across and re-install as usual (* DO NOT CHANGE THE VERSION NUMBER WHILST PERFORMING THIS TESTING, KEEP IT ALL THE SAME!). Again when your happy with it all you can change the version number and re-upload to the alpha console repeating steps 3 and 4.

And that’s it, well at least the way it worked for me and I wasted several hours if not days trying to get it all working by following the wrong information, so I hope this short guide helps you and I will endeavour to keep it up to date as such.

 

 

 

 

51649 Total Views 41 Views Today