Skip to content

Obb file for two APKs with different versionCodes not supported #23

Description

First of all, this is a really great tool! Thanks for making and maintaining it!

I am trying to upload 2 APKs, one for armv7 and one for arm64. As per the android documentation, the versionCode for the arm64 is one more than for the armv7 (eg. armv7=10, arm64=11). I have an expansion file for each of them, which in theory could be the same, but they are two different in my case.

Either way, I have looked through the code, and it seems as though only the first apk file (based on versionCode) will receive the obb file. This is unfortunate as I would like to use apkup to serve both the 64bit audience, and the older 32bit users.

My code for reference.

   const apks = [
        `./artifacts/${config.projectName}-arm64.apk`,
        `./artifacts/${config.projectName}-armv7.apk`
    ]
    const obbs = [
        `./artifacts/main.${config.buildNumber + 1}.${config.androidPackageName}.obb`,
        `./artifacts/main.${config.buildNumber}.${config.androidPackageName}.obb`
    ]
    apkup
        .upload(apks, {
            obbs,
            releaseNotes: [
                {
                    language: 'en-US',
                    text: myUpdateText
                }
            ],
            track: 'internal'
        })
        .then(data => {
            console.log(` > ${data.packageName} version ${data.versionCode} is up!`);
        });

Not sure how easy or hard it would be, but perhaps it would be possible to create an apkObject of some sorts that has a list of related obb files inside it, which in my case might perhaps look something like this:

apkup.upload([
    {
        apkPath:  ./artifacts/${config.projectName}-arm64.apk`,
        obbs: [`./artifacts/main.${config.buildNumber + 1}.${config.androidPackageName}.obb`]
    },{
        apkPath: `./artifacts/${config.projectName}-armv7.apk`,
        obbs: [`./artifacts/main.${config.buildNumber}.${config.androidPackageName}.obb`]
    }], 
    {
        releaseNotes: [
                {
                    language: 'en-US',
                    text: myUpdateText
                }
        ],
        track: 'internal'
    })

From an implementation point of view the configs above could be added without breaking existing interfaces by doing something like the below (typescript syntax)

export interface apkSpecificationObject {
    apkPath: string,
    obbs?: string[]
}
function upload(apk: string | string[] | apkSpecificationObject | apkSpecificationObject[]) {
    let apkArray: (string | apkSpecificationObject)[] = []
    if(Array.isArray(apk)){
        apkArray = apk
    } else {
        apkArray = [apk]
    }
    apkArray = apkArray.map(apkInTransit => {
        if(typeof apkInTransit === 'string') {
            return {
                apkPath: apkInTransit
            } 
        } else {
            return apkInTransit
        }
    })
    // ... do whatever we need to do with the list of apkSpecificationObjects from this point on
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions