9

Some time ago I've released a beta version of my app and connected it with an APK Expansion File. Then I wanted to update my APK without touching the files and did following:

The version code of my app was 7 and the provider also had this value. The provider looks like following in my manifest:

<provider
    android:name=".expansion.MyApezProvider"
    android:authorities="com.bla.blabla"
    android:exported="false"
    android:multiprocess="true"
>
    <meta-data
        android:name="mainVersion"
        android:value="7">
    </meta-data>
</provider>

And here is a snippet of my Downloader Activity:

private static final XAPKFile[] xAPKS = {new XAPKFile(true, // true signifies a main file
        7, // the version of the APK that the file was uploaded
        383989643L // the length of the file in bytes
)};

I've only incremented the version code value in the manifest from 7 to 8. Because I didn't wanted to touch the expansion file. Therefore the value in the provider and Downloader Activity were still 7.

I've uploaded the new APK File and did not choose the uploaded APK Expansion File again. But this did not work. After the Users updated to the new version the video files in the app are no more available.

So I uploaded the APK File again and re-upload the APK Expansion File and that works. But that's very strange because the user have to download the expansions for every single update.

My question is: When I upload the new apk to the Google Play Console do I have to choose always the stored apk expansion file or re-upload it again? Is the behavior of APK Expansion Files different in beta and relased version?

In the following post Updating an APK in Google Play without changing the expansion file it says that this behavior only happens in draft mode but my app is not in draft mode. It is published as beta.

I would be very thankful for your help.

Deno Agüero
  • 519
  • 2
  • 9
  • 27
  • I have the same problem. I was expecting the game to remain connected to the original expansion file, unless i uploaded a new one. But while in beta, at least, the expansion file is no longer available once i update the apk without re-uploading the expansion file... – Matteo Oct 14 '21 at 17:26

1 Answers1

2

You have to upload both files as this is the normal way.

Each time you upload an APK using the Google Play Console, you have the option to add one or two expansion files to the APK. Each file can be up to 2GB and it can be any format you choose, but we recommend you use a compressed file to conserve bandwidth during the download. Conceptually, each expansion file plays a different role:

The main expansion file is the primary expansion file for additional resources required by your application. The patch expansion file is optional and intended for small updates to the main expansion file. While you can use the two expansion files any way you wish, we recommend that the main expansion file deliver the primary assets and should rarely if ever updated; the patch expansion file should be smaller and serve as a “patch carrier,” getting updated with each major release or as necessary.

However, even if your application update requires only a new patch expansion file, you still must upload a new APK with an updated versionCode in the manifest. (The Play Console does not allow you to upload an expansion file to an existing APK.)

Note: The patch expansion file is semantically the same as the main expansion file—you can use each file any way you want. The system does not use the patch expansion file to perform patching for your app. You must perform patching yourself or be able to distinguish between the two files.

You can find more details here https://developer.android.com/google/play/expansion-files.html

Muhammad Saad Rafique
  • 3,158
  • 1
  • 13
  • 21
  • Thank you for your answer. I'm understanding the conecpt of main and patch expansion file and I'm only needing the main file. My main expansion file will never change and the question is: Do I have to upload it every time with a new version number if I'm updating only the apk? So I will have to always increment the value of the provider in my manifest and in the Downloader Activity to match the version code. Therefore the user have to download the big file for every update. I don't think that is the right way. – Deno Agüero Nov 04 '17 at 11:40