react-native-vector-icons打包报错并且提示:copyReactNativeVectorIconFonts相关信息

使用react-native-vector-icons,打包时会报:

FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':app:copyReactNativeVec
torIconFonts' (type 'Copy').
  - Gradle detected a problem with the following location: 'D:\rnDemo7\android\a
pp\build\intermediates\ReactNativeVectorIcons\fonts'.

    Reason: Task ':app:lintVitalAnalyzeRelease' uses this output of task ':app:c
opyReactNativeVectorIconFonts' without declaring an explicit or implicit depende
ncy. 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
:lintVitalAnalyzeRelease'.
      2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts'
 from ':app:lintVitalAnalyzeRelease' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts'
 from ':app:lintVitalAnalyzeRelease' using Task#mustRunAfter.

解决办法有两种:

一、在项目根文件夹中运行:yarn add react-native-vector-icons  对react-native-vector-icons进行修复。

二、修改您的项目文件夹  node_modules/react-native-vector-icons/fonts. gradle文件

afterEvaluate {
    android.applicationVariants.all { def variant ->
        def targetName = variant.name.capitalize()
      ++++  def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")  
      ++++  if (lintVitalAnalyzeTask) {  
      ++++     lintVitalAnalyzeTask.dependsOn(fontCopyTask)
      ++++  } 
        def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
        generateAssetsTask.dependsOn(fontCopyTask)
    }
}

然后在项目根文件夹中运行:npx patch-package react-native-vector-icons 进行修复。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值