Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task :app:copyReactNativeVectorIconFonts FAILED

Hello i programing a react-native which assembleDebug work but assembleRealease dont. i dont know why this happen & i solutions on internet dont work

What can i do?

> Task :app:copyReactNativeVectorIconFonts FAILED                                                                                                  

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':app:copyReactNativeVectorIconFonts' (type 'Copy').
  - Gradle detected a problem with the following location: 'D:\Cosas\UTN\APPMOVIL\HayEquipo\hayEquipo\android\app\build\intermediates\ReactNativeVectorIcons\fonts'.

    Reason: Task ':app:lintVitalReportRelease' 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:lintVitalReportRelease'.
      2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalReportRelease' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalReportRelease' 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.      
  - Gradle detected a problem with the following location: 'D:\Cosas\UTN\APPMOVIL\HayEquipo\hayEquipo\android\app\build\intermediates\ReactNativeVectorIcons\fonts'.

    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.      

BUILD FAILED in 1m 6s
318 actionable tasks: 14 executed, 304 up-to-date
like image 310
Gabriel Scarafia Avatar asked Apr 13 '26 10:04

Gabriel Scarafia


2 Answers

Here is the Patch to this Error: path: "your project folder"/node_modules/react-native-vector-icons/fonts.gradle.

Apply these changes:

afterEvaluate {
// ...

    android.applicationVariants.all { def variant ->
        def targetName = variant.name.capitalize()
        def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")  // here
            if (lintVitalAnalyzeTask) {  // here
                lintVitalAnalyzeTask.dependsOn(fontCopyTask) //here
            } // here
        def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
        generateAssetsTask.dependsOn(fontCopyTask)
    }
}
like image 105
Hitesh Attri Avatar answered Apr 14 '26 23:04

Hitesh Attri


This solution will work 100%

Remove below config from android/app/build.gradle

apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")

then copy all fonts from

/node_modules/react-native-vector-icons/Fonts

enter image description here

to

android/app/src/main/assets/fonts (create new if not exist)

enter image description here

like image 43
GianhTran Avatar answered Apr 14 '26 23:04

GianhTran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!