Verified
Status Update
Comments
vi...@google.com <vi...@google.com>
jo...@gmail.com <jo...@gmail.com> #2
I also confirm the same behaviour.
pa...@gmail.com <pa...@gmail.com> #3
I was able to reproduce it as well.
je...@google.com <je...@google.com>
js...@twitter.com <js...@twitter.com> #4
Can reproduce but it looks like this bug does not affect version 4.1.0-alpha04 though.
je...@google.com <je...@google.com>
ji...@google.com <ji...@google.com>
ju...@justeattakeaway.com <ju...@justeattakeaway.com> #5
Hi there We have just updated the AGP to its version 4.1.1 and I'm not sure this works or maybe we are doing something we are not supposed to?
android.applicationVariants.all {
val variant = this
if (variant.name.contains("someStringInTheName")) {
val baseconfig = variant.mergedFlavor as BaseConfigImpl
baseconfig.applicationIdSuffix = ".debug"
println("appIDsuffix: " + baseconfig.applicationIdSuffix)
println("appID-------: ${variant.applicationId}")
}
}
That block gets executed but the applicationId
is the original one, the suffix is never appended.
This way of doing works for the version 4.0.0 but it doesnt for 4.1.1 or the latest 4.2 beta. Is this deprecated somehow? if so, what's the new way of doing it?
Thanks a lot
Description
Version of Gradle Plugin: 4.1.x and superior
Version of Gradle: 6.5
Version of Java: 1.8
OS: Windows and Linux (tested on both)
This is an android gradle plugin bug. In the actual beta and alpha versions of gradle plugin, the setApplicationId method from mergedFlavor is not working at all. I attached a sample project that replicates the bug.
For example, if you select the app1FreeDebug variant from the sample app, and build the apk, when you open the output json file we should see this: "applicationId": "com.flavors.app1.free", and if in the classpath I'm in 4.0.0 gradle plugin version it works. But if I change to the beta version or the alpha version what we see is "applicationId": "com.flavors.appidtest",
which is the package name of the app and not the selected application id.
In resume:
// This not work
// classpath "com.android.tools.build:gradle:4.2.0-alpha03"
// This not work
// classpath "com.android.tools.build:gradle:4.1.0-beta02"
// This work
// classpath "com.android.tools.build:gradle:4.0.0"