Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling APK Expansion Files in beta and released version

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.

like image 735
Deno Agüero Avatar asked Oct 18 '17 12:10

Deno Agüero


People also ask

What is APK expansion files?

File name formatSpecifies whether the file is the main or patch expansion file. There can be only one main file and one patch file for each APK. <expansion-version> This is an integer that matches the version code of the APK with which the expansion is first associated (it matches the app's android:versionCode value).

What is .apk extension in Android?

An APK (Android Package Kit) is the file format for applications used on the Android operating system. APK files are compiled with Android Studio, which is the official integrated development environment (IDE) for building Android software. An APK file includes all of the software program's code and assets.

Where do I put APK files?

Submit an APK On Android, you can use ML Manager, which has built-in support for uploading to APKMirror. NOTE: Every APK file is manually reviewed by the APKMirror team before being posted to the site.


1 Answers

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

like image 90
Muhammad Saad Rafique Avatar answered Oct 16 '22 07:10

Muhammad Saad Rafique