React native link creates duplicate entries

I don’t know why it react-native linkcreates duplicate records in MainApplication.java(during import and in the getPackages function), but it app\build.gradle’s compile projectnot added to the record , but if I run the command again, I get the same message instead of the module already connected.

When I start react-native link, I get messages that the module was successfully connected on Android (duplicated), and on iOS it was already connected.

the result of the reaction-native connection

+4
source share
3 answers

Many users are faced with a problem on Android (including me). This is due to the difference between iOS and Android code.

( ) PR https://github.com/facebook/react-native/pull/18131 - ,

+1

, . - , , . , 3 :

  • android/settings.gradle: include() .

    include ':your_package_name'
    project(':your_package_name').projectDir = new File(rootProject.projectDir,'../node_modules/your_package_name')
    
  • android/app/build.gradle:

    compile project(':your_package_name')
    
  • android/app/src/main/java/[.. project_name..]/MainApplication.java: , getPackages() .

,
0

In my case, this was due to the RN version and local libraries.

I solved this by removing duplicate libraries on Xcode.

Here is the link

Hope this helps you.

0
source

Source: https://habr.com/ru/post/1679651/


All Articles