Open fiznool opened 2 years ago
I'm having this issue as well.
I also meet this issue.
same issue
same issue... :(
@fiznool can you provide more context with your workaround? I added those lines to the fonts.gradle
in the node_modules
but nothing changed.
This is causing a full rebuild on every run
@bit-void the lines above need to go inside the android.applicationVariants.all
block. Make sure you add these extra lines of code straight after the following:
// mergeResources task runs before the bundle file is copied to the intermediate asset directory from Android plugin 4.1+.
// This ensures to copy the bundle file before mergeResources task starts
def mergeResourcesTask = tasks.findByName("merge${targetName}Resources")
mergeResourcesTask.dependsOn(currentFontCopyTask)
// Put the extra lines here
// Make sure they come before the two closing braces
}
}
For me the workaround that work was comment the two lines and then add what fiznool put.
like this:
// def mergeResourcesTask = tasks.findByName("merge${targetName}Resources")
// mergeResourcesTask.dependsOn(currentFontCopyTask)
def compressAssetsTask = tasks.findByName("compress${targetName}Assets")
compressAssetsTask.dependsOn(currentFontCopyTask)
def processMainManifestTask = tasks.findByName("process${targetName}MainManifest")
processMainManifestTask.dependsOn(currentFontCopyTask)
def processManifestTask = tasks.findByName("process${targetName}Manifest")
processManifestTask.dependsOn(currentFontCopyTask)
def processManifestForPackageTask = tasks.findByName("process${targetName}ManifestForPackage")
processManifestForPackageTask.dependsOn(currentFontCopyTask)
def mergeJavaResourceTask = tasks.findByName("merge${targetName}JavaResource")
mergeJavaResourceTask.dependsOn(currentFontCopyTask)
def mergeExtDexTask = tasks.findByName("mergeExtDex${targetName}")
mergeExtDexTask.dependsOn(currentFontCopyTask)
def mergeNativeLibsTask = tasks.findByName("merge${targetName}NativeLibs")
mergeNativeLibsTask.dependsOn(currentFontCopyTask)
def mergeResourcesTask = tasks.findByName("merge${targetName}Resources")
mergeResourcesTask.dependsOn(currentFontCopyTask)
def stripDebugSymbolsTask = tasks.findByName("strip${targetName}DebugSymbols")
stripDebugSymbolsTask.dependsOn(currentFontCopyTask)
Some times it does not build or start android app. I try to run another time and it works... Strange... but for now... it was it is..
Same thing happening here on RN 0.68, using 9.0.0.
It seems to be a React Native issue: https://github.com/facebook/react-native/issues/33202
same here
When using Gradle 8, this warning becomes an error.
Here's a one line patch file for those who use patch-package
:
diff --git a/node_modules/react-native-vector-icons/fonts.gradle b/node_modules/react-native-vector-icons/fonts.gradle
index 5485fac..f1b8932 100644
--- a/node_modules/react-native-vector-icons/fonts.gradle
+++ b/node_modules/react-native-vector-icons/fonts.gradle
@@ -16,7 +16,7 @@ afterEvaluate {
type: Copy) {
description = "copy vector icon fonts."
into "$buildDir/intermediates/ReactNativeVectorIcons/fonts"
-
+ dependsOn "lintVitalReportRelease"
iconFontNames.each { fontName ->
from(iconFontsDir) {
include(fontName)
I'll disclose that I am not sure this is the way to fix it correctly. It does fix my build issues though.
I have another variant and faced a bit different error. Reason: Task ':app:lintVitalAnalyzeStagingRelease' uses this output of task ':app:copyReactNativeVectorIconFonts' without declaring an explicit or implicit dependency.
Im my case, following patch works.`
diff --git a/node_modules/react-native-vector-icons/fonts.gradle b/node_modules/react-native-vector-icons/fonts.gradle
index 5485fac..674c716 100644
--- a/node_modules/react-native-vector-icons/fonts.gradle
+++ b/node_modules/react-native-vector-icons/fonts.gradle
@@ -16,7 +16,6 @@ afterEvaluate {
type: Copy) {
description = "copy vector icon fonts."
into "$buildDir/intermediates/ReactNativeVectorIcons/fonts"
-
iconFontNames.each { fontName ->
from(iconFontsDir) {
include(fontName)
@@ -28,5 +27,13 @@ afterEvaluate {
def targetName = variant.name.capitalize()
def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
generateAssetsTask.dependsOn(fontCopyTask)
+
+ if (targetName.contains("Release")) {
+ fontCopyTask.dependsOn("lintVitalReport${targetName}")
+ fontCopyTask.dependsOn("lintVitalAnalyze${targetName}")
+ }
}
}
Environment
Description
I have added
react-native-vector-icons
to my React Native project using RN 0.67. I am using Gradle wrapper 7.3.3 but the behaviour is the same for 7.2.When running
npx react-native run-android --variant debug
I see the following in the terminal:The same warning is repeated for other gradle tasks too.
This is just a warning - the app still compiles and builds ok
Reproducible Demo
npx react-native run-android --variant debug
Dirty workaround
I've added the following to
fonts.gradle
which removes the warning, but I am sure there is a better way to do this.