Changing Default Port (I.E. 5037) on Which Adb Server Runs

Change ADB Port

command to run adb server on different port
adb -P 12345 start-server

adb server starts on 12345 port

ddms: 'adb.exe,start-server' failed -- run manually if necessary, Android Studio

I solve this problem at last! I finally found the program name of the pid and I kill it in the task manager.

The way to detect is described in the question:

  1. adb nodaemon server

Output:

cannot bind 'tcp:5037'

2.and then netstat -ano | findstr 5037 to find who takes this port.

Get the pid and find it in the task manager. Please note that the process tab may not show the column of pid, we should include it by setting.

In my case, it is tfadb.exe who takes this port! This is a Chinese Video program client! Try to kill it in task manager.

Now I stop it starting from booting. The problem is solved.

Running React Native in WSL with the emulator running directly in Windows

AFAIK it is not possible to use react-native in WSL due to a number of issues.

e.g. https://github.com/Microsoft/BashOnWindows/issues/1523

However, I've found a workaround that combines a native windows android build with a npm stack in WSL. Realistically, you'll want to install the native Windows Android Studio/SDK to use the Intellij IDE and the emulator anyway. The trick is to separate out the Gradle based Android compile.

Workflow

All project setup and package management performed in WSL with npm/yarn. react-native-cli installed globally in WSL. No need for a duplicate windows binary node/npm stack.

Don't use react-native run-android, instead compile and deploy from cmd. From the /android directory inside your project, execute the gradle wrapper gradlew.bat installDebug, or with the Creator's Update, you can do this from inside the WSL bash shell /mnt/c/Windows/System32/cmd.exe /C gradlew.bat installDebug. Don't use the unix gradlew script.

Once the APK has been assembled and uploaded to your device or emulator, run the debug server from within WSL using the command react-native start.

I've tested this out with some fairly complex projects using multiple native Android components. Hope this helps.

  • Note: For this to work your project needs to be located in the native Windows file system i.e. /mnt/c.


Related Topics



Leave a reply



Submit