Closed andreirat closed 1 month ago
I found this possible solution on https://stackoverflow.com/a/76658738
Thanks for @VincentSastra providing the solution here: https://github.com/oblador/react-native-vector-icons/issues/1508#issuecomment-1664993744
And I created a post-install script to automate this, here is my code
/* package.json */
...
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
+ "postinstall": "node scripts/react-native-vector-icons.mjs"
},
...
/* scripts/react-native-vector-icons.mjs */
import { readFileSync, writeFileSync } from 'node:fs'
import { resolve } from 'node:path'
const fontGradlePath = resolve('node_modules/react-native-vector-icons/fonts.gradle')
const fontGradle = readFileSync(fontGradlePath, { encoding: 'utf-8' })
const appendTask = `
def lintAnalyzeTask = tasks.findByName("lintAnalyze\${targetName}")
lintAnalyzeTask?.dependsOn(fontCopyTask)
`
const dependsOnStr = '.dependsOn(fontCopyTask)'
const firstLine = appendTask.split('\n').filter((it) => it)[0]
if (!fontGradle.includes(firstLine)) {
const insertPosition =
fontGradle.lastIndexOf(dependsOnStr) + dependsOnStr.length
const newfontGradle = [
fontGradle.slice(0, insertPosition),
appendTask,
fontGradle.slice(insertPosition)
].join('\n')
writeFileSync(fontGradlePath, newfontGradle, { encoding: 'utf-8' })
}
I suspect this is related to #1534
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?
Do you found any solution?
Closing as this should be fixed in the latest release
Environment
Android react-native: 0.72.6 react-native-vector-icons: ^10.0.1
Description
While building the app in AppCenter, the build fails with the following message:
FAILURE: Build failed with an exception.
What went wrong: A problem was found with the configuration of task ':app:lintAnalyzeRelease' (type 'AndroidLintAnalysisTask').
Reason: Task ':app:lintAnalyzeRelease' 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/***guide/validation_problems.html#implicit_dependency for more details about this problem.
Try:
Get more help at https://help.gradle.org
BUILD FAILED in 23m 57s
Any idea why is this happening?