Unable to connect with server while running react native app on real android device

后端 未结 1 1318
北荒
北荒 2021-01-22 04:22

I am trying to run my react native app on my real android device as the laptop gets too hot while using Android studio (8 Gb RAM, the pain). Hence, I enabled my USB debugging, p

相关标签:
1条回答
  • 2021-01-22 05:02

    You should follow these steps to connect with the bundler.

    1. Make sure that the app and bundler using the same network.

    2. If you are using android add this code in your androidMenifest.xml file.

      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
      <uses-permission 
      android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
       <application
         android:usesCleartextTraffic="true" // make sure that this line is added.
           .......>
            .......
       </application>
      
    3. if you are adding localhost in the developer setting try to add your IP address like this, yourIP:yourPort

      example: 192.168.89.24:8081

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