Closed Pivosoft closed 1 month ago
This patch solution might works for you: https://stackoverflow.com/a/76614223
See also the closed issue #1508 re. 10.0-rc6
Though some of the fixes referred to in that issue thread are redundant, having already been incorporated into 10.0.0, the additional patch described toward the end of the thread fixed this build failure for me: https://github.com/oblador/react-native-vector-icons/issues/1508#issuecomment-1677801324
@timhatch Are you sure you're running 10.0.0? The extra lines in the comment you mentioned should already exist in fonts.gradle
.
Where did you add them?
@oblador
I've double checked the package.json and it's 10.0.0 The relevant lines in the fonts.gradle file are/were (prior to patching):
android.applicationVariants.all { def variant ->
def targetName = variant.name.capitalize()
def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
generateAssetsTask.dependsOn(fontCopyTask)
def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
lintVitalAnalyzeTask?.dependsOn(fontCopyTask)
}
and I've checked these against the same file in this repo.
The patch file contents are:
diff --git a/node_modules/react-native-vector-icons/fonts.gradle b/node_modules/react-native-vector-icons/fonts.gradle
index ddcf377..1084091 100644
--- a/node_modules/react-native-vector-icons/fonts.gradle
+++ b/node_modules/react-native-vector-icons/fonts.gradle
@@ -30,6 +30,9 @@ afterEvaluate {
def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
generateAssetsTask.dependsOn(fontCopyTask)
+ def lintAnalyzeTask = tasks.findByName("lintAnalyze${targetName}")
+ lintAnalyzeTask?.dependsOn(fontCopyTask)
+
def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
lintVitalAnalyzeTask?.dependsOn(fontCopyTask)
}
Scrolling back through my terminal output I can see that the original build failure message was as follow:
* What went wrong:
A problem was found with the configuration of task ':app:lintAnalyzeDebug' (type 'AndroidLintAnalysisTask').
- Gradle detected a problem with the following location: '/Users/timhatch/Development/ifsc/wm23-RN72/android/app/build/intermediates/ReactNativeVectorIcons'.
Reason: Task ':app:lintAnalyzeDebug' 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:lintAnalyzeDebug'.
2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintAnalyzeDebug' using Task#dependsOn.
3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintAnalyzeDebug' using Task#mustRunAfter.
Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
..so actually my issue was adjacent (i.e. lintAnalyzeDebug) rather the same (lintVitalAnalyze). It certainly confused me for a while as yarn run android
worked fine without the patch. It was only running ./gradlew build
following the installation instructions for the react-native-bootsplash
package that caused/indicated any problem,
Ahh, thanks. I looked at both bits of code, and they looked identical at first glance. :smile: I'll do some testing on this tonight.
@oblador No problem. It caught me out also - and I can't pretend to understand the difference usage of lintAnalyzeDebug
, lintAnalyze
and lintVitalAnalyze
. The inner workings of Gradle are a mystery to me.
Any news here :-)? Also struggling with this error :-/
react native version: 7.2.4, I also encountered the same problem The error is the same as below: Upgrading react-native-vector-icons to 10.0.0 did not solve this problem
/**
* Register font asset source folder
*/
android.sourceSets.main.assets.srcDirs += file("$buildDir/intermediates/ReactNativeVectorIcons")
/**
* Task to copy icon font files
*/
afterEvaluate {
def config = project.hasProperty("vectoricons") ? project.vectoricons : [];
def iconFontsDir = config.iconFontsDir ?: "../../node_modules/react-native-vector-icons/Fonts";
def iconFontNames = config.iconFontNames ?: [ "*.ttf" ];
def fontCopyTask = tasks.create(
name: "copyReactNativeVectorIconFonts",
type: Copy) {
description = "copy vector icon fonts."
into "$buildDir/intermediates/ReactNativeVectorIcons/fonts"
iconFontNames.each { fontName ->
from(iconFontsDir) {
include(fontName)
}
}
}
android.applicationVariants.all { def variant ->
def targetName = variant.name.capitalize()
def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
generateAssetsTask.dependsOn(fontCopyTask)
def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
lintVitalAnalyzeTask?.dependsOn(fontCopyTask)
}
}
> Task :app:lintAnalyzeDebug FAILED
w: Detected multiple Kotlin daemon sessions at build\kotlin\sessions
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:lintAnalyzeDebug' (type 'AndroidLintAnalysisTask').
- Gradle detected a problem with the following location: 'D:\Users\Administrator\react-project\WhatAi\android\app\build\intermediates\ReactNativeVectorIcons'.
Reason: Task ':app:lintAnalyzeDebug' 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 ord
er the tasks are executed.
Possible solutions:
1. Declare task ':app:copyReactNativeVectorIconFonts' as an input of ':app:lintAnalyzeDebug'.
2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintAnalyzeDebug' using Task#dependsOn.
3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintAnalyzeDebug' using Task#mustRunAfter.
Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
+1
Same issue. Any update?
I'd like to put this to bed once and for all, but I'm not experiencing this my project using RNVI on android.
Is someone able to provide a reproducible example repository?
Currently having similar issue after upgrading to RN0.72.7, has anyone gotten a fix for this.
same here
@vecchiomatias @joviksdev @Pivosoft @johnf 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
This patch solution might works for you: https://stackoverflow.com/a/76614223
@myselfmustafa thanks, worked for me.
This should be fixed in the latest release
FAILURE: Build failed with an exception.
What went wrong: A problem was found with the configuration of task ':app:lintVitalAnalyzeRelease' (type 'AndroidLintAnalysisTask').
Reason: Task ':app:lintVitalAnalyzeRelease' 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:
Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.