【问题标题】:react-native Link - repeated invocations keep appending to configuration files [duplicate]react-native Link - 重复调用不断附加到配置文件[重复]
【发布时间】:2025-12-08 18:25:02
【问题描述】:

React Native Link 似乎不会解析对配置文件的先前更改,而是进行增量、重复的更改。

例如,android/app/build.gradle 开头为:

dependencies {
  compile project(':react-native-linear-gradient')
  compile project(':react-native-fcm')
  compile project(':react-native-cookie')
}

第一次调用react-native link之后

dependencies {
  compile project(':react-native-vector-icons')
  compile project(':react-native-linear-gradient')
  compile project(':react-native-fcm')
  compile project(':react-native-cookie')
  compile project(':react-native-linear-gradient')
  compile project(':react-native-fcm')
  compile project(':react-native-cookie')
}

第二次调用后...

dependencies {
  compile project(':react-native-vector-icons')
  compile project(':react-native-linear-gradient')
  compile project(':react-native-fcm')
  compile project(':react-native-cookie')
  compile project(':react-native-vector-icons')
  compile project(':react-native-linear-gradient')
  compile project(':react-native-fcm')
  compile project(':react-native-cookie')
  compile project(':react-native-linear-gradient')
  compile project(':react-native-fcm')
  compile project(':react-native-cookie')
}

等等……

有什么好的地方可以开始我的调查吗?

【问题讨论】:

    标签: react-native react-native-linking


    【解决方案1】:

    嘿,你的答案就在那里:react-native link causes duplicate imports in Android settings.gradle

    它目前处于 PR 并正在测试中。

    【讨论】:

    • 昨天不知何故我的搜索技巧让我失望了。大声喊叫!