When i run a react native simple app using command.react-native run-android.Then i got an error "could not connect to a development server, although my packager is also run.
            Asked
            
        
        
            Active
            
        
            Viewed 9,049 times
        
    3
            
            
        - 
                    3Possible duplicate of [\[react-native\]could not connect to development server on android](https://stackoverflow.com/questions/42064283/react-nativecould-not-connect-to-development-server-on-android) – Uzair A. Nov 22 '18 at 09:35
2 Answers
3
            There is a few things you can try to solve this.
From the React Native official docs (https://facebook.github.io/react-native/docs/troubleshooting) you could try to "terminate the process on port 8081" by running:
$ sudo lsof -i :8081
$ kill -9 <PID>
You will run the second command on all PIDs that are using port 8081 (this will terminate your emulator too).
Then, restart the emulator and in one terminal, run:
$ npm start
and on a second terminal:
$ react-native run-android
Hope this can help!
 
    
    
        perotta
        
- 146
- 4
- 
                    i got this error when run 'kill -9 pid' ***zsh: parse error near `\n'*** – famfamfam Apr 15 '22 at 18:24
0
            
            
        Starting with Android 9.0 (API level 28), cleartext support is disabled by default.
 
    
    
        John Zhang
        
- 55
- 1
- 1
- 7
