Closed auras closed 7 months ago
We have the same issue, but it happens very rarely and randomly.
But I think that solution is clear, not?
Gradle detected a problem with the following location: '/home/tcagent/.buildAgent/work/master/cleaner/app/build/generated/res/google-services/defaultBackendTest/debug'. Reason: Task ':app:mergeDefaultBackendTestDebugResources' uses this output of task ':app:processDefaultBackendTestDebugGoogleServices' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3/userguide/validation_problems.html#implicit_dependency for more details about this problem
So should be enough to declare dependency between mergeResources and processGoogleServices, to be sure, that order of it will be always deterministic, now it is somehow random.
Maybe using org.gradle.parallel=false would solve it, but it will probably also increase the build time. I did not try it.
If you need a working workaround (Groovy):
afterEvaluate {
mergeDebugResources.mustRunAfter(processDebugGoogleServices)
mergeReleaseResources.mustRunAfter(processReleaseGoogleServices)
}
Maybe not very DRY, but does the job 😄
a kotlin dsl version that works with multiple buildTypes and productFlavors
afterEvaluate {
val buildTypes = android.buildTypes.map { it.name.capitalize() }
val productFlavors = android.productFlavors.map { it.name.capitalize() }
productFlavors.forEach { productFlavor ->
buildTypes.forEach { buildType ->
val processGoogleServicesTask = tasks
.findByName("process${productFlavor}${buildType}GoogleServices") ?: error("googleTask not found")
val mergeResourcesTask = tasks
.findByName("merge${productFlavor}${buildType}Resources") ?: error("mergeTask not found")
mergeResourcesTask.mustRunAfter(processGoogleServicesTask)
}
}
}
Below a Groovy version that works with multiple buildTypes and productFlavors
project.afterEvaluate {
android.applicationVariants.all { variant ->
logger.trace("variant.name: ${variant.name}")
def googleServicesTask = tasks.findByName("process${variant.name.capitalize()}GoogleServices")
variant.mergeResources.mustRunAfter(googleServicesTask)
}
}
After updating to Google services plugin 4.3.13, I made a handful of test compilations and I don't think this happens anymore. The release notes for 4.3.12 point to "improved compatibility with AGP 7.1+" (#180), so maybe this is resolved with that PR.
Describe the bug After updating to
4.3.10
our builds sometimes are missing some fields likegoogle_app_id
andgoogle_api_key
. There's no indication of a build problem (I would expect a build fail) during the build process only when starting the app and noticing that firebase is crashing because thegoogle_app_id
is missing.It only happens on some builds, on our CI, and those builds are from the command line. It happens both for debug and release builds.
To Reproduce Steps to reproduce the behavior:
Expected behavior
google_app_id
andgoogle_api_key
should be part of the resourcesDesktop (please complete the following information):
Additional context
I noticed this message during the build when it happend: