It's no secret Windows Subsystem for Linux (WSL) is very popular with web Developers on Windows 10.
When I found I can manipulate files on Windows through /mnt/c/
I began to try to move most of my computing to WSL and avoid cmd.exe
.
I was saddened to see Node.js server and adb server did not function like the Windows native implementations did. This forced me to work with two environments, one in bash and one in Powershell.
Recently, I happened upon a github issue for WSL, where a user stated they had it working. It was determined that ADB under WSL was working. Under one condition: Window's and WSL's adb server versions must be the same version.
Verifying my ADB versions
The commands for ADB are cross platform
Cmd.exe:
C:> adb version
Android Debug Bridge version version 1.0.36
WSL:
$ adb version
Android Debug Bridge version 1.0.32
$ which adb
/usr/bin/adb
In the case of the Ubuntu install. I had to wget
a newer version. I had originally installed my android tools from a file glob using apt install android-tools-*
Conveniently I found the repository hosted by simmac.
Because I use this package on Windows I tried a quick wget
on the Google hosted adb binary expecting it to be the same version.
Once I had the file I had give it execute permissions and test it.
$ ls -l adb
-r--r--r--. 1 mikey mikey 8488 Dec 14 13:50 adb
$ sudo chmod 755 ./adb
$ adb kill-server
$ ./adb start-server && ./adb version
* daemon not running. starting it now at tcp:5037 *
* daemon started successfully *
Android Debug Bridge version 1.0.36
Perfect! They're the same version.
I always recommend using the sdk-manager in order to obtain your android-tools.
After proving this worked I replaced the Ubuntu binary with the Google hosted adb binary as root.
root@hostname:/ mv /home/mikey/adb /usr/bin/adb
root@hostname:/ chmod 775 /usr/bin/adb
root@hostname:/ chown root:android /usr/bin/adb
Now that the binary is in place I can stop the adb server running in WSL and start server on the Windows host.
I can verify this by plugging in my device trying to find it.
$ adb devices
List of devices attached
015d2994ec2xxx device
I am sure this will help any react or node mobile developers on Windows. If anyone has gotten Node.js server running from inside WSL I would love to hear about it!