I have an android project, and I recently updated to Kotlin 1.9, Java 17, and Gradle 8.2.
I have been able to successfully update and build everything on my machine, but when I try to build the app in bitrise.io, the build fails with this exception:
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':apps:produceAppnameReleaseBundleIdeListingFile' (type 'BundleIdeModelProducerTask').
- In plugin 'com.android.internal.version-check' type 'com.android.build.gradle.internal.tasks.BundleIdeModelProducerTask' property 'finalBundleFile' specifies file
'/bitrise/src/droid/apps/build/outputs/bundle/appnameRelease/apps-appname-
release.aab' which doesn't exist.
Reason: An input file was expected to be present but it doesn't exist.
Possible solutions:
1. Make sure the file exists before the task is called.
2. Make sure that the task which produces the file is declared as an input.
What I have tried:
- Clean Project, Clean Cache, Invalidate & Restart
- Running
./gradlew app:assembleRelease -Pandroid.debug.obsoleteApi=true --dry-run
in the terminal to determine which step creates the.aab
file- This resulted in each task being skipped
- Adding some after evaluate rules in the module level
build.gradle
file to the section that processes tasks:
android {
...
applicationVariants.configureEach { variant ->
...
afterEvaluate {
tasks.matching { it.name == "produce${variant.name.capitalize()}BundleIdeListingFile" }.configureEach { task ->
task.dependsOn tasks.named("copy${variant.name.capitalize()}Bundle")
}
tasks.named("copy${variant.name.capitalize()}Bundle").configure { task ->
task.dependsOn tasks.named("bundle${variant.name.capitalize()}")
}
tasks.named("produce${variant.name.capitalize()}BundleIdeListingFile").configure { task ->
task.mustRunAfter tasks.named("copy${variant.name.capitalize()}Bundle")
}
}
}
There are hundreds of tasks that are generated during this process, but I can’t find a way to determine which (if any) are the tasks that create the .aab
Perhaps it is generated somewhere else, but I have not found a suitable solution that will resolve this.
If you have an idea and need more info, let me know and I will post more code.