Using Expansion Files with Android and Google Play

In this post, I’d like to talk about using expansion files with your Android app for Google Play. If your app is over 50MB, and it very well can be in the case of music heavy apps such as Night Night Sleep Tight, Google will force you to use an expansion pack for your app. Expansion packs simply hold all of the non-code assets such as music, graphics, or anything else non-code related.

With this requirement, Corona Labs has released the ability for developers to create expansion packs for the apps. While they have done a great job on introducing the feature, I’d like to take it a step further with some screenshots to walk you through the process.

In a nutshell, you’ll have to edit your build.settings file, grab your Google license key and edit your config.lua file, and finally upload the apk to Google Play with the expansion file (otherwise known as a .obb file). So, let’s get started!

In your build.settings file, add usesExpansionFile = true and the permissions for Internet, Check License and Write External Storage to the android table.

build.settings

settings = 
{
	orientation =
	{
		default = "landscapeLeft",
		supported = { "portrait", "portraitUpsideDown", "landscapeLeft", "landscapeRight" }
	},
	android =
		{
			usesExpansionFile = true,
			usesPermissions =
			{
				"android.permission.INTERNET",
				"com.android.vending.CHECK_LICENSE",
				"android.permission.WRITE_EXTERNAL_STORAGE"
			},
		},
}

After the build.settings file, you’ll want to add a table named license with you Google License key. Your Google License key is found within your store listing under Services & APIs. The key will be a very long set of numbers and letters and at the time of this writing, is placed in the grey box in the screenshot below where it says ‘Your Google Key will be found here.’ You can click on the image below for a bigger screenshot.

Screen Shot 2013-12-30 at 11.28.23 PM

config.lua

application =
{
	content =
	{
		width = 768,
		height = 1024,
		scale = "letterbox",
	},
	license =
	{
		google =
		{
			key = "Your key here"
		},
	},
}

After you’ve setup build.settings and config.lua, you’ll need to build your app for Google Play. Corona will then hand you two files – an .apk file and an .obb file. The apk file is what you is installed on the users device and the .obb file is the expansion pack the user will download to use your app.

Once you have these files, go back to your Store listing and click on Upload new APK under the APK option. After you’ve uploaded the APK file, you’ll get an option to upload an expansion file. This is where you’ll want to upload the .obb file Corona made for you. Take a look at the screenshot below to see what the upload screen looks like.

Screen Shot 2013-12-30 at 11.38.30 PM

After you’ve uploaded the .obb file, publish your app (if your store listing is completely filled out) and then it’ll show up within a few hours. Pretty cool right? If you have questions or comments, just let me know below. If you’d like to receive updates on new tutorials, sign up for my newsletter using the form on the right hand side.

Thanks for reading!


6 Comments
  1. I already uploaded version 1.0 of my app to google play along with its obb file. Then, now a want to update my app, a new app file and obb file created by Corona. How do I upload the new .obb file to the store? When tried to upload a new version, after finish uploading the new apk file, then i upload the new obb file, the google play console displayed the new obb file as a patch, am i doing it right? I’m not sure, so I keep the old version on the store until someone gives me the right answer on this. Any suggestion for me?

    • Hello, I believe your doing it right, it’s been a while since I’ve went through the update process for my app. As long as you uploaded the expansion file with the updated apk, it should be fine. If you wanted to test the process, you could create another app with an expansion file and upload it to the store. Then, update it with a new expansion pack and see what happens. If you do this, I would suggest using a different account if possible. Hope this helps!

  2. What we encountered is that you need to be in “Advanced Mode” then upload apk which gives the option to include an expansion obb file.

    The problem we had though, was after the 160MB obb file uploaded and we clicked “Save Draft” and then we only saw the apk showing. There was no obb file in the list.

    We hit Publish and have our fingers crossed.

    Such tiny details and they get glossed over all the time. Who knows what’s the right way, even after reading such helpful articles as this one because we all experience something a little different each time.

    : )

  3. My app shows as 5.7MB in the Google Play store but I know the .obb file is 160MB

    Is this correct? Will the file size in the Google Play store show as the .apk file size only and not the .obb?

    • I believe Google Play shows the apk file size and not the additional files.

  4. Can you help me please i want to upload my apk file so kindly tell me how to upload many problems to upload large apk i dont know how to Create Expansion File i,m new pleas help me

Leave a Reply