Closed yuroyami closed 8 months ago
As a workaround, adding this to my shared module's build.gradle.kts
would resolve the issue:
tasks.withType<AndroidLintAnalysisTask>{
dependsOn("copyFontsToAndroidAssets")
}
tasks.withType<LintModelWriterTask>{
dependsOn("copyFontsToAndroidAssets")
}
This might be a Gradle plugin/wrapper incompatibility though. I am still not sure. I am using Gradle 8.5 and AGP 8.2.0.
Could you please provide a minimal reproducer project?
Have you tried other gradle and AGP versions?
These two tasks are: :shared:generateReleaseLintVitalModel and :shared:lintVitalAnalyzeRelease
These two tasks are not added by Compose Multiplatform. I guess they're added by AGP. So I think it's worth trying with different AGP versions.
It looks to me this is related with the new resources in 1.6.0
Gradle detected a problem with the following location: '/path/to/project/build/generated/compose/resourceGenerator/androidFonts'.
I've also encountered this. Steps to reproduce:
compose-plugin
dependency from 1.6.0-alpha01
to 1.6.0-beta01
./gradlew :composeApp:build
It fails with:
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':composeApp:lintVitalAnalyzeRelease' (type 'AndroidLintAnalysisTask').
- Gradle detected a problem with the following location: '/Users/arkivanov/Downloads/Miner/composeApp/build/generated/compose/resourceGenerator/androidFonts'.
Reason: Task ':composeApp:lintVitalAnalyzeRelease' uses this output of task ':composeApp:copyFontsToAndroidAssets' 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 ':composeApp:copyFontsToAndroidAssets' as an input of ':composeApp:lintVitalAnalyzeRelease'.
2. Declare an explicit dependency on ':composeApp:copyFontsToAndroidAssets' from ':composeApp:lintVitalAnalyzeRelease' using Task#dependsOn.
3. Declare an explicit dependency on ':composeApp:copyFontsToAndroidAssets' from ':composeApp:lintVitalAnalyzeRelease' using Task#mustRunAfter.
For more information, please refer to https://docs.gradle.org/8.4/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
If I updated AGP from 8.1.4
to 8.2.2
, then the build fails with:
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':composeApp:generateReleaseLintVitalReportModel' (type 'LintModelWriterTask').
- Gradle detected a problem with the following location: '/Users/arkivanov/Downloads/Miner/composeApp/build/generated/compose/resourceGenerator/androidFonts'.
Reason: Task ':composeApp:generateReleaseLintVitalReportModel' uses this output of task ':composeApp:copyFontsToAndroidAssets' 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 ':composeApp:copyFontsToAndroidAssets' as an input of ':composeApp:generateReleaseLintVitalReportModel'.
2. Declare an explicit dependency on ':composeApp:copyFontsToAndroidAssets' from ':composeApp:generateReleaseLintVitalReportModel' using Task#dependsOn.
3. Declare an explicit dependency on ':composeApp:copyFontsToAndroidAssets' from ':composeApp:generateReleaseLintVitalReportModel' using Task#mustRunAfter.
For more information, please refer to https://docs.gradle.org/8.4/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
As a workaround, adding this to my shared module's
build.gradle.kts
would resolve the issue:tasks.withType<AndroidLintAnalysisTask>{ dependsOn("copyFontsToAndroidAssets") } tasks.withType<LintModelWriterTask>{ dependsOn("copyFontsToAndroidAssets") }
This might be a Gradle plugin/wrapper incompatibility though. I am still not sure. I am using Gradle 8.5 and AGP 8.2.0.
This saved me from errors after updating to version 1.6.0-beta01.
In case this is helpful, I'm also seeing this, on release builds only, using these:
Project uses the composeResources support for a few drawables (PNG images). In this project all the compose multiplatform code is in a separate module named "uiCommon". There are 4 other modules in the project, and only the uiCommon module gets these gradle errors that make release builds fail. The gradle errors displayed all suggest the gradle task dependencies below are required and are missing (I'm cherry-picking from the output):
A problem was found with the configuration of task ':uiCommon:generateReleaseLintModel' (type 'LintModelWriterTask').
1. Declare task ':uiCommon:copyFontsToAndroidAssets' as an input of ':uiCommon:generateReleaseLintModel'.
A problem was found with the configuration of task ':uiCommon:lintVitalAnalyzeRelease' (type 'AndroidLintAnalysisTask').
1. Declare task ':uiCommon:copyFontsToAndroidAssets' as an input of ':uiCommon:lintVitalAnalyzeRelease'.
A problem was found with the configuration of task ':uiCommon:generateReleaseLintVitalModel' (type 'LintModelWriterTask').
1. Declare task ':uiCommon:copyFontsToAndroidAssets' as an input of ':uiCommon:generateReleaseLintVitalModel'.
So it looks like at a minimum tasks generateReleaseLintVitalModel, lintVitalAnalyzeRelease, and generateReleaseLintModel all need task copyFontsToAndroidAssets as an input or an explicit dependency.
Oh, and I forgot to mention I can confirm that the same work-around from alpine12 also fixes my build.
gradle = gradle-8.8-all.zip androidGradlePlugin = "8.2.0" composeMultiplatform = "1.7.0-dev1698" kotlin = "2.0.0"
Still having the same issue.
Because IDEA 2024.1.4 only supports 8.2.0, AGP cannot be upgraded temporarily.
@terrakok
If I need to upgrade AGP, then I need to wait for 2024.2 to be released.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Kotiln: 2.0.0-Beta1 and 1.9.21 Compose version: 1.6.0-dev1350
When I try to release an APK from my project, two tasks throw an error, both of which say that "they use output from this task
:shared:copyFontsToAndroidAssets
without declaring an explicit or implicit dependency".These two tasks are:
:shared:generateReleaseLintVitalModel
and:shared:lintVitalAnalyzeRelease
The stacktrace: