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.31k stars 2.12k forks source link

React native 0.73 fails to build release #1584

Closed tri-bao closed 2 weeks ago

tri-bao commented 6 months ago

RN 0.73 upgraded using https://react-native-community.github.io/upgrade-helper/?from=0.72.4&to=0.73.1 AGP: 8.2.0 Gradle 8.3 react-native-vector-icons 10.0.3

The issue is similar to #1508 but this time the error is with other task generateReleaseLintVitalReportModel:

A problem was found with the configuration of task ':app:copyReactNativeVectorIconFonts' (type 'Copy').
  - Gradle detected a problem with the following location: '..../android/app/build/intermediates/ReactNativeVectorIcons/fonts'.

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

Adding the following to fonts.gradle fixes it

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

Could you please release a new release with that?

Vimal1464 commented 6 months ago

@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

tri-bao commented 6 months ago

thanks @Vimal1464 while that works I had used patch-package to add the required task dependency into react-native-vector-icons/fonts.gradle

Vimal1464 commented 6 months ago

Welcome @tri-bao. Can we follow each other ? as I am new to GitHub looking for some friends ...

tri-bao commented 6 months ago

Welcome @tri-bao. Can we follow each other ? as I am new to GitHub looking for some friends ...

sure, followed

Vimal1464 commented 6 months ago

@tri-bao followed too. ❤️ are you on discord ?? mine is vimal1464

ahmeturganci commented 5 months ago

In my case i just add apply from:("../../node_modules/react-native-vector-icons/fonts.gradle"); in android\app\build.gradle then problem fixed for me

vijaychouhan-rails commented 5 months ago

In my case I added

-keep class com.facebook.react.fabric.** { *; }

in /android/app/proguard-rules.pro and its started working

Jouskar commented 5 months ago

For my case, I've added the related dependency to build.gradle. For your code, it probably would be like:

tasks.configureEach {
        if (name == 'generateReleaseLintVitalReportModel') {
            dependsOn('copyReactNativeVectorIconFonts')
        }
    }

I hope it helps 🙏. P.S: After implementing this method, the package seemed not to be working. I had to reset the cache.

cdiddy77 commented 4 months ago

I had this same error, but on the lintAnalyze${targetName} task. I used @Jouskar workaround thanks muchly!

shubhanshubb commented 3 months ago

https://github.com/oblador/react-native-vector-icons/issues/1604 "I'm currently working on a React Native project (version 0.73.2) and encountering an issue with react-native-vector-icons integration. Despite following the installation steps (npm install --save react-native-vector-icons followed by pod install), the RNVectorIcons library does not seem to be added to my Podfile.lock or properly linked in my Xcode project. Auto-linking should work with my React Native version, but it appears to be missing. Is there a known issue or step I'm overlooking for React Native 0.73.2?"

gregmarut commented 2 months ago

Here is the patch patch for anyone that needs it

diff --git a/node_modules/react-native-vector-icons/fonts.gradle b/node_modules/react-native-vector-icons/fonts.gradle
index 951394b..ad15ebd 100644
--- a/node_modules/react-native-vector-icons/fonts.gradle
+++ b/node_modules/react-native-vector-icons/fonts.gradle
@@ -32,6 +32,11 @@ afterEvaluate {
         lintVitalAnalyzeTask.dependsOn(fontCopyTask)
         }

+        def generateReportTask = tasks.findByName("generate${targetName}LintVitalReportModel")
+        if (generateReportTask) {
+            generateReportTask.dependsOn(fontCopyTask)
+        }
+      
         def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
         generateAssetsTask.dependsOn(fontCopyTask)
       }
Rajeshkaligram commented 2 months ago

For my case, I've added the related dependency to build.gradle. For your code, it probably would be like:

tasks.configureEach {
        if (name == 'generateReleaseLintVitalReportModel') {
            dependsOn('copyReactNativeVectorIconFonts')
        }
    }

I hope it helps 🙏. P.S: After implementing this method, the package seemed not to be working. I had to reset the cache.

Thank you worked!

syedzeeshanahmed commented 1 month ago

generateReleaseLintVitalReportModel

path ?

johnf commented 2 weeks ago

This should have been fixed in the May 1 release