Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling dynamic version codes for ABI-specific APKs #15

Closed
ph0b opened this issue Jun 30, 2015 · 5 comments
Closed

Handling dynamic version codes for ABI-specific APKs #15

ph0b opened this issue Jun 30, 2015 · 5 comments

Comments

@ph0b
Copy link
Contributor

ph0b commented Jun 30, 2015

When different APKs are generated for each ABIs, these must have different version codes in order to be published to the Play Store as multiple APKs for a single application.

With the previous DSL, this could be easily accomplished using such task:

// map for the version code
project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9]

android.applicationVariants.all { variant ->
    // assign different version code for each output
    variant.outputs.each { output ->
        output.versionCodeOverride =
                project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + android.defaultConfig.versionCode
    }
}

or by modifying the version code from a flavor declaration:

x86 {
       ndk.abiFilters = "x86"
       versionCode = project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + defaultConfig.versionCode
    }

This behavior should be part of the samples whether they're using splits or abiFilters to generate arch-specific APKs.

However, I couldn't find a way to do the same with the new DSL, could you look into implementing this with the new DSL ?

@proppy
Copy link
Contributor

proppy commented Jun 30, 2015

Thanks @ph0b

If that's not available with the new DSL, we should file a feature request on tools.android.com, if this is available we should update our sample to use it.

Let's keep this issue open to track the latter.

@c3ph3us
Copy link

c3ph3us commented Jul 10, 2015

// You can modify configuration for each variant.
components.android {
binaries.afterEach { binary ->
//.........
}
}

@ph0b
Copy link
Contributor Author

ph0b commented Jul 11, 2015

Thanks for the pointer.
Unfortunately, I've looked at binary.targetAbi but it's currently empty when using abiFilters and splits aren't adding any flavors.

I couldn't find how to read the version code from there either.

@proppy
Copy link
Contributor

proppy commented Aug 3, 2015

/cc @rschiu

@ggfan
Copy link
Contributor

ggfan commented Aug 2, 2018

seems to be experimental related, closing

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

No branches or pull requests

4 participants