android / android/nowinandroid
[Bug]: BaselineProfile automaticGenerationDuringBuild fails with instrumentation error on release build
- Dominant language
- Kotlin
- Stars
- 21.8k
- Forks
- 4.6k
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is there a StackOverflow question about this issue?
- [x] I have searched StackOverflow
### What happened?
Hello,
I downloaded the Now in Android repository to test the automaticGenerationDuringBuild property of the baseline profile, and I attempted to create a signed app bundle by running a release build.
As far as I know, when this property is set to true, a Baseline Profile should be automatically generated during the release build.
However, when I actually ran it, I encountered the following build errors in the Task execution. How can this be resolved?
### Relevant logcat output
```shell
**1. Instrumentation Error**
> Task :benchmarks:pixel6Api33ProdNonMinifiedReleaseAndroidTest
Test run failed to complete. Unable to find instrumentation info for: ComponentInfo{com.google.samples.apps.nowinandroid.benchmarks/androidx.test.runner.AndroidJUnitRunner}
> Task :benchmarks:pixel6Api33ProdNonMinifiedReleaseAndroidTest FAILED
Execution failed for task ':benchmarks:pixel6Api33ProdNonMinifiedReleaseAndroidTest'.
> There were failing tests. See the report at: file:///Users/jeongtaegmin/Desktop/AndroidStudio/now-test/benchmarks/build/reports/androidTests/managedDevice/nonminifiedrelease/flavors/prod/pixel6Api33/index.html
**2. Gradle Dependency Error**
A problem was found with the configuration of task ':app:createProdNonMinifiedReleaseApkListingFileRedirect' (type 'ListingFileRedirectTask').
- Gradle detected a problem with the following location: '/Users/jeongtaegmin/Desktop/AndroidStudio/now-test/app/prod/nonMinifiedRelease/output-metadata.json'.
Reason: Task ':app:createProdNonMinifiedReleaseApkListingFileRedirect' uses this output of task ':benchmarks:packageProdNonMinifiedRelease' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':benchmarks:packageProdNonMinifiedRelease' as an input of ':app:createProdNonMinifiedReleaseApkListingFileRedirect'.
2. Declare an explicit dependency on ':benchmarks:packageProdNonMinifiedRelease' from ':app:createProdNonMinifiedReleaseApkListingFileRedirect' using Task#dependsOn.
3. Declare an explicit dependency on ':benchmarks:packageProdNonMinifiedRelease' from ':app:createProdNonMinifiedReleaseApkListingFileRedirect' using Task#mustRunAfter.
For more information, please refer to https://docs.gradle.org/9.0.0/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start by reproducing the signed release build with automaticGenerationDuringBuild enabled and inspect the reported benchmarks:pixel6Api33ProdNonMinifiedReleaseAndroidTest and app:createProdNonMinifiedReleaseApkListingFileRedirect tasks. Check the generated Android test report and Gradle task dependency diagnostics; done means the release build completes, instrumentation runs, and the baseline profile is generated without either reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100