Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React native 0.73 fails to build release #1584

Open
tri-bao opened this issue Dec 23, 2023 · 13 comments
Open

React native 0.73 fails to build release #1584

tri-bao opened this issue Dec 23, 2023 · 13 comments

Comments

@tri-bao
Copy link

tri-bao commented Dec 23, 2023

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
Copy link

@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
Copy link
Author

tri-bao commented Dec 25, 2023

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

@Vimal1464
Copy link

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

@tri-bao
Copy link
Author

tri-bao commented Dec 25, 2023

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

sure, followed

@Vimal1464
Copy link

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

@ahmeturganci
Copy link

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
Copy link

In my case I added

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

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

@Jouskar
Copy link

Jouskar commented Jan 24, 2024

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
Copy link

cdiddy77 commented Feb 2, 2024

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

@shubhanshubb
Copy link

#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
Copy link

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
Copy link

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
Copy link

generateReleaseLintVitalReportModel

path ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
10 participants