React native 0.73 fails to build release
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 To fix this ,follow these step
- remove apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle") from android/app/build.gradlew
- go to node_modules/react-native-vector-icon/Fonts and copy all the fonts
- 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
- now you can use the vector icon as usual and also you can create a build which won't failed
thanks @Vimal1464 while that works I had used patch-package to add the required task dependency into react-native-vector-icons/fonts.gradle
Welcome @tri-bao. Can we follow each other ? as I am new to GitHub looking for some friends ...
Welcome @tri-bao. Can we follow each other ? as I am new to GitHub looking for some friends ...
sure, followed
@tri-bao followed too. ❤️ are you on discord ?? mine is 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
In my case I added
-keep class com.facebook.react.fabric.** { *; }
in /android/app/proguard-rules.pro and its started working
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.
I had this same error, but on the lintAnalyze${targetName} task. I used @Jouskar workaround thanks muchly!
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?"
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)
}
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!
generateReleaseLintVitalReportModel
path ?
This should have been fixed in the May 1 release