💨

【react-native】./gradlew assembleReleaseを実行時、エラーが発生する

2024/02/04に公開

背景

react-native-vector-iconを表示させようと設定をいじった後に、リリース作業で「./gradlew assembleRelease」というコマンドを実施すると、下記エラーが発生する。

> Task :app:copyReactNativeVectorIconFonts FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':app:copyReactNativeVectorIconFonts' (type 'Copy').
  - Gradle detected a problem with the following location: '/Users/xxx/app/yyy/android/app/build/intermediates/ReactNativeVectorIcons/fonts'.
    
    Reason: Task ':app:lintVitalReportRelease' 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:lintVitalReportRelease'.
      2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalReportRelease' using Task#dependsOn.
      3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalReportRelease' using Task#mustRunAfter.

対処法

  • 最新バージョンか確認
npm view react-native-vector-icons version
# 10.0.3と出力(現在は9.2.0だった)
  • 最新にバージョンアップ
npm install react-native-vector-icons@latest
  • 問題なくbuildできるようになりました。

参考リンク

https://stackoverflow.com/questions/76649318/task-appcopyreactnativevectoriconfonts-failed

Discussion