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

problem was found with the configuration of task ':app:generateDebugLintReportModel' (type 'LintModelWriterTask'). #1631

Closed
danielaloycedaniel opened this issue Jun 30, 2024 · 4 comments

Comments

@danielaloycedaniel
Copy link

I get this error when i try to build an app in react native.
This error persist whenever i try to use react-native-vector-icons inside my project

C:\Users\HP\Desktop\NativeApps\Project\NativeApp\android>gradlew build
> Task :app:generateDebugLintReportModel FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:generateDebugLintReportModel' (type 'LintModelWriterTask').
  - Gradle detected a problem with the following location: 'C:\Users\HP\Desktop\NativeApps\Project\NativeApp\android\app\build\intermediates\ReactNativeVectorIcons'.

    Reason: Task ':app:generateDebugLintReportModel' 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:generateDebugLintReportModel'.
      2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:generateDebugLintReportModel' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:generateDebugLintReportModel' using Task#mustRunAfter.

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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 3m 10s
156 actionable tasks: 4 executed, 152 up-to-date

I am using:

  1. gradle-8.6
  2. react-native-cli: 2.0.1
  3. react-native: 0.74.2
  4. Node v20.13.1
@david-gettins
Copy link

david-gettins commented Jul 8, 2024

For React Native 0.74.x you will need to apply the following patch:

@@ -26,18 +26,28 @@ afterEvaluate {

     android.applicationVariants.all { def variant ->
         def targetName = variant.name.capitalize()
-        def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")

+        def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
         if (lintVitalAnalyzeTask) {
-        lintVitalAnalyzeTask.dependsOn(fontCopyTask)
+            lintVitalAnalyzeTask.dependsOn(fontCopyTask)
+        }
+
+        def lintAnalyzeTask = tasks.findByName("lintAnalyze${targetName}")
+        if (lintAnalyzeTask) {
+            lintAnalyzeTask.dependsOn(fontCopyTask)
         }

-        def generateReportTask = tasks.findByName("generate${targetName}LintVitalReportModel")
+        def generateVitalReportTask = tasks.findByName("generate${targetName}LintVitalReportModel")
+        if (generateVitalReportTask) {
+            generateVitalReportTask.dependsOn(fontCopyTask)
+        }
+
+        def generateReportTask = tasks.findByName("generate${targetName}LintReportModel")
         if (generateReportTask) {
             generateReportTask.dependsOn(fontCopyTask)
         }

         def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
         generateAssetsTask.dependsOn(fontCopyTask)
-      }
+    }
 }

It seems as though the lint task names have changed when going from gradle 8.3 to 8.6.

@johnf
Copy link
Collaborator

johnf commented Aug 25, 2024

@danielaloycedaniel @david-gettins Can you try this for me https://github.com/oblador/react-native-vector-icons/pull/1648/files

I'm want to tey a different direction for this since we've had to keep changing it the last few releases

@xuqun123
Copy link

xuqun123 commented Sep 13, 2024

Im encountering the same error in RN 0.74.3.

For a temp fix, im adding the following codes into the bottom of android/app/build.gradle file (still a newbie to RN land, not sure if this is a proper temp solution, though 😅):

afterEvaluate {
    tasks.named('generateDebugLintReportModel').configure {
        dependsOn tasks.named('copyReactNativeVectorIconFonts')
    }

    tasks.named('lintAnalyzeDebug').configure {
        dependsOn tasks.named('copyReactNativeVectorIconFonts')
    }    
}

@johnf
Copy link
Collaborator

johnf commented Sep 15, 2024

Will be fixed in upcoming release by #1648

@johnf johnf closed this as completed Sep 15, 2024
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 a pull request may close this issue.

4 participants