groff07 groff07 - 1 month ago 41x
Android Question

How to make Android Expansion File using Android Studio?

I need to upload an

but it exceeds the 50 MB limit.

I read about this on documentation and some questions but I'm having difficulty to make this work.

Does anyone have some tutorial that explain how to do this (using Android Studio) and if there is some way to use Gradle to do this ?


I've done this on a few projects, but I never figured out a simple way. The instructions at

helped me get my head around the basics, but I found parts of the process (like "android update project") didn't work properly with Gradle.

The instructions below will help you set up your project with the required libraries. After that you can go back to the official docs and figure out what to do with all the stuff you just included.

Add these permissions to AndroidManifest.xml

<uses-permission android:name=""/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name=""/>

Add Play Services dependency to build.gradle

dependencies {

    compile ''

Open SDK Manager and install Google Play APK Expansion Library and Google Play Licensing Library.

Copy java source files from these folders into your project's source/main/java folder:






Copy drawable-hdpi, drawable-mdpi and layout into your project's source/main/res folder.

For all files in the values folders, merge content from the file into the matching file in your project.

Create a class which extends android.content.BroadcastReceiver

Add something like this to your manifest:

<receiver android:name="mypackage.MyReceiver"/>

Create a class which extends

Add something like this to your manifest:

<service android:name="mypackage.MyDownloaderService"/>

Compile the project and look for errors relating to


Import your own project resources here instead.