skip to Main Content
  • What went wrong:
    A problem was found with the configuration of task ‘:app:lintVitalAnalyzeRelease’ (type ‘AndroidLintAnalysisTask’).

    • Gradle detected a problem with the following location: ‘C:React-ProjectsEnglish-MuniandroidappbuildintermediatesReactNativeVectorIcons’.

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

      Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.

Here is the app/build.gradle file

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"


import com.android.build.OutputFile


android {
  ndkVersion rootProject.ext.ndkVersion

  compileSdkVersion rootProject.ext.compileSdkVersion

  namespace "com.englishmuni"
defaultConfig {
    applicationId "com.englishmuni"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 36
    versionName "1.0.32"
    buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", 
    isNewArchitectureEnabled().toString()
    multiDexEnabled true
  }
   }

     }

dependencies {

  implementation project(':react-native-vector-icons')
}

apply from: file("../../node_modules/@react-native-community/cli-platform- 
android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

2

Answers


  1. Here is the simpler patch that works for variants on RN 0.72,for vector icons. You have to replace these lines in /node_modules/react-native-vector-icons/fonts.gradle

    afterEvaluate {
         .
         .
         .
         android.applicationVariants.all { def variant ->
            def targetName = variant.name.capitalize()
            def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
                if (lintVitalAnalyzeTask) {
                    lintVitalAnalyzeTask.dependsOn(fontCopyTask)
                }
            def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
            generateAssetsTask.dependsOn(fontCopyTask)
        }
    

    then patch the package. npx patch-package react-native-vector-icons

    Login or Signup to reply.
  2. The solution provided above worked for me after looking for possible solution and spending hours.
    I added below lines in /node_modules/react-native-vector-icons/fonts.gradle:

    afterEvaluate {
     .
     .
     .
     android.applicationVariants.all { def variant ->
        def targetName = variant.name.capitalize()
        def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
            if (lintVitalAnalyzeTask) {
                lintVitalAnalyzeTask.dependsOn(fontCopyTask)
            }
        def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
        generateAssetsTask.dependsOn(fontCopyTask)
    }
    

    and then I tried npx patch-package react-native-vector-icons in terminal:

    and cd android
    ./gradlew assembleRelease
    and Boom! it worked!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search