Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Gradle task dependency (include lintAnalyze) #1719

Open
wants to merge 1 commit into
base: 10.x
Choose a base branch
from

Conversation

friederbluemle
Copy link

@friederbluemle friederbluemle commented Feb 26, 2025

I had an error with a build (RN 0.73, Gradle 8.3, react-native-vector-icons 10.2.0):

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:lintAnalyzeDebug' (type 'AndroidLintAnalysisTask').
  - Gradle detected a problem with the following location: '/path/to/android/app/build/intermediates/ReactNativeVectorIcons'.

    Reason: Task ':app:lintAnalyzeDebug' uses this output of task ':app:copyReactNativeVectorIconFonts' 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 ':app:copyReactNativeVectorIconFonts' as an input of ':app:lintAnalyzeDebug'.
      2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintAnalyzeDebug' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintAnalyzeDebug' using Task#mustRunAfter.

    For more information, please refer to https://docs.gradle.org/8.3/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

After some digging, I found a similar error related to lintVitalAnalyze (addressed in #1515 and #1577).
Notice how this error is different (lintAnalyze, not lintVitalAnalyze).

Related discussions: #1508 #1588

The issue was resolved by also including lintAnalyze in the tasks that depend on the font copy task (there were already three other similar tasks in fonts.gradle).

I consolidated task names into a list and iterate through them to set dependencies. This reduces redundancy and improves maintainability. It also fixes a couple minor whitespace errors and indentation issues on those same lines.

@gowravl
Copy link

gowravl commented Feb 27, 2025

Hey @friederbluemle , can you include "generate${variantName}LintModel" task in the taskNames list. I'm facing a similar issue related to this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants