oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.45k stars 2.12k forks source link

React native 0.72-rc6 android relase error What went wrong: A problem was found with the configuration of task ':app:lintVitalAnalyzeRelease' (type 'AndroidLintAnalysisTask'). #1574

Open qnit82 opened 11 months ago

qnit82 commented 11 months ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-vector-icons@9.2.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-vector-icons/fonts.gradle b/node_modules/react-native-vector-icons/fonts.gradle
index 5485fac..bff75a2 100644
--- a/node_modules/react-native-vector-icons/fonts.gradle
+++ b/node_modules/react-native-vector-icons/fonts.gradle
@@ -25,7 +25,11 @@ afterEvaluate {
     }

     android.applicationVariants.all { def variant ->
-        def targetName = variant.name.capitalize()
+       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)
     }

This issue body was partially generated by patch-package.

qnit82 commented 11 months ago

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) }

Once done, run the command npx patch-package react-native-vector-icons To fix this error in the package so it won't happen next time

Vimal1464 commented 10 months ago

@qnit82 @tri-bao To fix this ,follow these step 1) remove apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle") from android/app/build.gradlew 2) go to node_modules/react-native-vector-icon/Fonts and copy all the fonts 3) go to android/app/src/main and create a folder named assets if not exist then inside then assets create one more folder named fonts and paste all the fonts from node_modules/react-native-vector-icon/Fonts to here 4) now you can use the vector icon as usual and also you can create a build which won't failed