React Native adb reverse ENOENT

前端 未结 7 2120
悲&欢浪女
悲&欢浪女 2020-12-01 04:59

I am trying to get React-Native to work with Android V4.2.2 (Genymotion) but I am unable to test the app on the Emulator. When I ran react-native run-andr

相关标签:
7条回答
  • 2020-12-01 05:29

    this was my solutions operating system: Linux mint

    sudo apt-get install android-tools-adb
    
    0 讨论(0)
  • 2020-12-01 05:29

    This answer is for MacOs Catalina user or zsh users as your Mac now uses zsh as the default login shell and interactive shell.

    This is related to path issues.

    If you follow along with the docs of React Native Setting up the development environment guide. Then do the following.

    1. Open ~/.zshrc using editor. In my case I use vim
    vim ~/.zshrc
    
    1. Add the following line for the path.
    export ANDROID_HOME="/Users/<yourcomputername>/Library/Android/sdk"
    export PATH=$ANDROID_HOME/emulator:$PATH
    export PATH=$ANDROID_HOME/tools:$PATH
    export PATH=$ANDROID_HOME/tools/bin:$PATH
    export PATH=$ANDROID_HOME/platform-tools:$PATH
    

    Make sure to add the above line correctly else it will give you a weird error.

    1. Save the changes and close the editor.

    2. Finally, now compile your changes

    source ~/.zshrc
    

    I get this working in my case. I hope this helps you.

    0 讨论(0)
  • 2020-12-01 05:30

    First I have setup the path in .bash_profile like this

    export PATH="~/Library/Android/sdk/platform-tools":$PATH
    export ANDROID_HOME="~/Library/Android/sdk/platform-tools"
    

    But it does not resolve my problem.

    For me by adding following npm script in package.json under script tag worked like charm on Mac.

    "android-dev": "adb reverse tcp:8081 tcp:8081 && react-native run-android"
    

    Then I am simply running npm run android-dev and it's all set. Make sure that in your app setting Live reload is enabled already, in this way I can worked on development server on my mobile and see the coding changes immediately in app.

    0 讨论(0)
  • 2020-12-01 05:32

    Starting with macOS Catalina, your Mac uses zsh as the default login shell and interactive shell. You can make zsh the default in earlier versions of macOS as well. More details on zsh from Apple

    So on your Mac:

    1 - Open your .zshrc file:

    open ~/.zshrc
    

    2 - if .zshrc file doesn't exist, you need to create one & open again(Step 1)

    touch ~/.zshrc
    

    3 - Add this to your .zshrc file

    export ANDROID_SDK=/Users/<your_computer_name>/Library/Android/sdk
    export PATH=/Users/<your_computer_name>/Library/Android/sdk/platform-tools:$PATH
    

    4 - Save and close

    5 - Compile your changes

    source ~/.zshrc
    

    & make sure to restart your terminal.

    0 讨论(0)
  • 2020-12-01 05:37

    I also got the same issue. And I updated my ANDROID_HOME env variable again in same cmd and it was worked fine.

    > export ANDROID_HOME=~/Android/Sdk 
    > export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
    

    good luck

    0 讨论(0)
  • 2020-12-01 05:39

    I solved this error with installing adb

    On Linux

    sudo apt-get install android-tools-adb
    
    0 讨论(0)
提交回复
热议问题