React Native 'hello world' quick start: “could not connect to development server”

前端 未结 6 1918
面向向阳花
面向向阳花 2021-02-18 14:21

I\'m trying to do the react native \'hello world\', and I\'m using usb debugging on my android.

I ran react-native run-android, then react-native sta

6条回答
  •  花落未央
    2021-02-18 15:02

    10 mins ago I had the same problem I guess, and the way I solved this was reading this

    https://facebook.github.io/react-native/docs/running-on-device-android.html

    and when I did that, I found that I didn't have android-tools-adb installed, so looking around I found

    'No command 'adb' found' error on Ubuntu

    which gives me the answer

    sudo apt-get install android-tools-adb
    

    and after all this I set

    export PATH=${PATH}:~/android-sdk-linux/tools
    export PATH=${PATH}:~/android-sdk-linux/platform-tools
    

    then everything works fine, now I can see my app in my Android device.

    BTW the option I choose from react native docs was the one that says me

    "Using adb reverse

    Note that this option is available on devices running Android 5.0+ (API 21). Have your device connected via USB with debugging enabled (see paragraph above on how to enable USB debugging on your device).

    Run adb reverse tcp:8081 tcp:8081
    

    You can use Reload JS and other development options with no extra configuration

提交回复
热议问题