react-native-vector-icons icon indicating copy to clipboard operation
react-native-vector-icons copied to clipboard

React native 0.73 fails to build release

Open tri-bao opened this issue 2 years ago • 12 comments

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?

tri-bao avatar Dec 23 '23 07:12 tri-bao

@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

Vimal1464 avatar Dec 25 '23 03:12 Vimal1464

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

tri-bao avatar Dec 25 '23 05:12 tri-bao

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

Vimal1464 avatar Dec 25 '23 07:12 Vimal1464

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

sure, followed

tri-bao avatar Dec 25 '23 07:12 tri-bao

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

Vimal1464 avatar Dec 25 '23 07:12 Vimal1464

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

ahmeturganci avatar Jan 05 '24 19:01 ahmeturganci

In my case I added

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

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

vijaychouhan-rails avatar Jan 10 '24 13:01 vijaychouhan-rails

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.

Jouskar avatar Jan 24 '24 10:01 Jouskar

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

cdiddy77 avatar Feb 02 '24 00:02 cdiddy77

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?"

shubhanshubb avatar Mar 20 '24 13:03 shubhanshubb

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

gregmarut avatar Apr 26 '24 19:04 gregmarut

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!

Rajeshkaligram avatar Apr 28 '24 19:04 Rajeshkaligram

generateReleaseLintVitalReportModel

path ?

syedzeeshanahmed avatar May 16 '24 15:05 syedzeeshanahmed

This should have been fixed in the May 1 release

johnf avatar Jun 10 '24 14:06 johnf