Skip to content

Build error - A problem was found with the configuration of task ':app:lintAnalyzeDebug' #1588

@leonardo-coutinho-dev

Description

@leonardo-coutinho-dev

Hey guys, I am facing an issue when trying to build a project with ./gradlew build, on the android folder!

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: 'C:\Projetos\hph-services-app\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.

I was trying to build on windows

------------------------------------------------------------
Gradle 8.0.1
------------------------------------------------------------

Build time:   2023-02-17 20:09:48 UTC
Revision:     68959bf76cef4d28c678f2e2085ee84e8647b77a

Kotlin:       1.8.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.2 (Oracle Corporation 11.0.2+9)
OS:           Windows 10 10.0 amd64
"react-native-vector-icons": "^10.0.2",
"react-native": "0.72.6",

I saw some solutions here:

#1508

Solution:

Adding the following lines to node_modules/react-native-vector-icons/fonts.gradle

/**
 * Register font asset source folder
 */
android.sourceSets.main.assets.srcDirs += file("$buildDir/intermediates/ReactNativeVectorIcons")

/**
 * Task to copy icon font files
 */
afterEvaluate {
    def config = project.hasProperty("vectoricons") ? project.vectoricons : [];
    def iconFontsDir = config.iconFontsDir ?: "../../node_modules/react-native-vector-icons/Fonts";
    def iconFontNames = config.iconFontNames ?: [ "*.ttf" ];

    def fontCopyTask = tasks.create(
        name: "copyReactNativeVectorIconFonts",
        type: Copy) {
        description = "copy vector icon fonts."
        into "$buildDir/intermediates/ReactNativeVectorIcons/fonts"

        iconFontNames.each { fontName ->
            from(iconFontsDir) {
                include(fontName)
            }
        }
    }

    android.applicationVariants.all { def variant ->
        def targetName = variant.name.capitalize()

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

        def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
        lintVitalAnalyzeTask?.dependsOn(fontCopyTask)

        // add this: --------------------->
        def lintAnalyzeTask = tasks.findByName("lintAnalyze${targetName}")
        lintAnalyzeTask?.dependsOn(fontCopyTask)
    }
}

Check the two lines after // add this: --------------------->

@oblador

The error is similar to #1508 but this time with task lintAnalyzeTask

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions