Concern about Google Play APK Expansion Files

Hello,

I have a concern about Google Play APK expansion files. My APK is 10MB, and the expansion file is 328MB. When I download my app from Google Play the first time on a device, the App Manager shows the application is 340MB. If I upload a new APK with a new expansion file, and update the app in the same device, the App Manager is now showing it being 660MB.

I’m concerned that maybe the old expansion file is kept and not removed when the app is updated. This is a concern because every update will require more space on the user’s device, thus making this harder for people to install my app.

Am I reading this correctly? Can someone confirm that this is indeed happening and if there’s a way to prevent this from happening?

Thanks,

George

Hi @george.faraj,

Are you building your APK and expansion file to the Corona project’s directory? If so, the expansion file will be bundled into the next expansion file that you build. In that case, the solution would be to build to a separate directory.

Brent

No Brent, I always build to a separate folder. My project’s folder is 325MB in size.

Hi @george.faraj,

We just tested this on our end. When I build my project for Android with an expansion file, the file size of the APK and *.obb is always the same. So, I’m not seeing any issues. I’m thinking that you are mistakenly adding files to your Corona project directory.

How it works is that all files in your Corona project directory and sub-directories will be automatically bundled within the *.obb expansion file except for:

  • *.lua files  (These are always compiled and bundled within the APK.)

  • *.apk files  (These are always excluded in case you build to the project directory.)

  • *.obb files  (These are always excluded in case you build to the project directory.)

  • Files or directories starting with a ‘.’  (ie: hidden files/directories)

Please confirm this and see if there’s something unusual going on.

Thanks,

Brent

Hey Brent,

So let’s back up a bit. The expansion file generated by Corona is fine, it always has the right size. I’m talking about the size that the Android Application Manager reports to the user, that is the one that I have seen to be double the correct size.

So, what I think could be happening is that when the app is updated (a new expansion file is downloaded), the old expansion file could have not been deleted.

Thanks,

George

Hi George,

Regarding expansion files, we of course have no control over how Google Play handles them. Google Play is supposed to delete the old one. In fact, you can test this by looking on the SD card afterwards. Now, if Google Play does not automatically download the expansion file, Corona will download it instead. We definitely do delete the old expansion file, and the engineers just reconfirmed this by looking at our code.

Note that there is nothing special or magical about an expansion file… it’s really just a zip file. There are no settings made to the APK either. So, there’s really nothing on our end that can effect this behavior.

Take care,

Brent

Thanks for your response Brent, I’ll try to gather more information about this.

Hi, I just finished building my Android App and when I tried to upload the .apk to Google Play I received an error message saying I needed expansion files. How do I create the expansion file? 

Hi @ameka.ali,

Please check out the appropriate sections of the following guides:

  1. http://docs.coronalabs.com/guide/distribution/buildSettings/index.html#expansion-files

2) http://docs.coronalabs.com/guide/basics/configSettings/index.html#licensing

Hope this helps,

Brent

Thank you, that seemed to work. It created a .apk and an .obb file. But, now I’m getting an error message saying I build with the signature key, “debug” and it needs to be “release”. I didn’t get any other options in the drop down before I build other than “debug”.

Keystore: debug

Key Alias: androddebugkey"

How do I change the signature key?

Hi @ameka.ali,

OK, the next step is to generate your own private release keystore. Please refer to the following guide under “Signing for Release Build” for instructions:

http://docs.coronalabs.com/guide/distribution/androidBuild/index.html

Take care,

Brent

Thanks Brent. I have generated my release key. 

I found this tutorial on the forum that was useful to generate the release key too:

http://coronalabs.com/blog/2014/08/26/tutorial-understanding-android-app-signing/

Hello Brent:

  I think I have the same problem like @george.faraj

 My APK is 11.4 MB and the OBB is 72.5 MB. This is my build version 23 using CORONA 2511. In my build before 23, I build the APK with older version of CORONA SDK. I think the APK expansion is working file. But for this build version 23 using CORONA 2511, Google play said my download size is 140MB. Will that be a mistake by Google or by Corona Build 2511? Can you check this for us. My customer was complain about the double size of my app.

Bob

Actually, bobyeh.1390, I don’t think that’s the same issue I was having. My app shows with the correct size in Google Play. It was in my phone’s Application Manager that I saw the wrong size.

I’ve actually tested this further and I haven’t been able to reproduce it. It might have just been a really rare case.

What you’re experiencing seems to me like you’re probably setting up your APK with 2 expansion files, instead of just the one. There’s the “main” expansion and then there’s the “patch” expansion. Ensure that you’re always uploading your expansion file as the “main” expansion. The main expansion file will default to the last expansion file you uploaded, if you don’t change it.

There’s an easy way to check whether this was the issue. If you go to your application in the Google Play Developer Console and go to the APK tab, click on the build version that has the wrong size. Look under “Expansion files” in the popup window. If that lists 2 files then that’s your issue. Upload a new APK and upload the expansion file in the right slot and you should be good to go.

Hope that helps,

George

Hi, george.faraj:

 Thank you for your response. You are right, my mistake.

 Sorry, Brent.

Bob

Hi @george.faraj,

Are you building your APK and expansion file to the Corona project’s directory? If so, the expansion file will be bundled into the next expansion file that you build. In that case, the solution would be to build to a separate directory.

Brent

No Brent, I always build to a separate folder. My project’s folder is 325MB in size.

Hi @george.faraj,

We just tested this on our end. When I build my project for Android with an expansion file, the file size of the APK and *.obb is always the same. So, I’m not seeing any issues. I’m thinking that you are mistakenly adding files to your Corona project directory.

How it works is that all files in your Corona project directory and sub-directories will be automatically bundled within the *.obb expansion file except for:

  • *.lua files  (These are always compiled and bundled within the APK.)

  • *.apk files  (These are always excluded in case you build to the project directory.)

  • *.obb files  (These are always excluded in case you build to the project directory.)

  • Files or directories starting with a ‘.’  (ie: hidden files/directories)

Please confirm this and see if there’s something unusual going on.

Thanks,

Brent

Hey Brent,

So let’s back up a bit. The expansion file generated by Corona is fine, it always has the right size. I’m talking about the size that the Android Application Manager reports to the user, that is the one that I have seen to be double the correct size.

So, what I think could be happening is that when the app is updated (a new expansion file is downloaded), the old expansion file could have not been deleted.

Thanks,

George

Hi George,

Regarding expansion files, we of course have no control over how Google Play handles them. Google Play is supposed to delete the old one. In fact, you can test this by looking on the SD card afterwards. Now, if Google Play does not automatically download the expansion file, Corona will download it instead. We definitely do delete the old expansion file, and the engineers just reconfirmed this by looking at our code.

Note that there is nothing special or magical about an expansion file… it’s really just a zip file. There are no settings made to the APK either. So, there’s really nothing on our end that can effect this behavior.

Take care,

Brent