How to use wsa as an alternative to avd in Android Studio in wsl2
why I need to use wsa as an alternative to avd in Android Studio in wsl
- avd run fails on wsl2
- connect real machine to wsl2 is complicated and even expensive
Before you start
Make sure that:
- install wsl2 android-studio and android-platform-tools
- install wsa see how
How to perform a task
- start wsa and enable dev mode
- solve adb connect failed caused by wrong ip in wsl
edit “C:\Users\YOU.wslconfig” ,add networkingMode=mirrored to [wsl2],you will get:
[wsl2]
networkingMode=mirrored
see why
3. connect
in wsl2 terminal run
Android/Sdk/platform-tools/adb connect 127.0.0.1:58526
the adb is installed default in ~/Android/Sdk/platform-tools/adb
4. open android-studio and it is