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
this was my solutions operating system: Linux mint
sudo apt-get install android-tools-adb
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.
~/.zshrc
using editor. In my case I use vimvim ~/.zshrc
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.
Save the changes and close the editor.
Finally, now compile your changes
source ~/.zshrc
I get this working in my case. I hope this helps you.
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.
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.
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
I solved this error with installing adb
On Linux
sudo apt-get install android-tools-adb