react-native link causes duplicate imports in Android settings.gradle

后端 未结 2 1669
自闭症患者
自闭症患者 2021-01-12 10:16

For some reason when I call react-native link, it adds duplicate includes to android/settings.gradle which in turn adds duplicate imports to

相关标签:
2条回答
  • 2021-01-12 10:58

    This is a known bug on React Native. There's currently a PR pending for this bug: https://github.com/facebook/react-native/pull/18131

    Update: The bug has been fixed!

    To address this issue, you'll just have to manually comb through your dependencies whenever you run react-native-link. I find it's helpful to have a clean git status before running it, then going over the changed files afterwards with git diff afterwards.

    0 讨论(0)
  • 2021-01-12 11:19

    CAUTION: Before executing below steps please take a backup of your project.

    If i would have face this kind of problem then i would have deleted all the dependency from the settings.graddle except the include ':app', from getpackages except the new MainReactPackage() and from the app/build.graddle i would have removed all dependencies except the:

    dependencies {
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:23.0.1"
        compile "com.facebook.react:react-native:+"
    } 
    

    After removing all the above code i would have ran react-native link.

    Cheers(coffee) :)

    0 讨论(0)
提交回复
热议问题