While Ubuntu on WSL can execute most any Windows binary, keep in mind that Windows binaries still won't understand Linux paths, processes, environment variables, and some other configuration items/files that Ubuntu provides. For this reason, I typically recommend that you run Windows programming tools such as the Android SDK from Windows. If you want to use the Linux version of the Android SDK, you can do that from Ubuntu under WSL.
For instance, you mention that you exported ANDROID_SDK_ROOT
, but a Windows process started from inside Ubuntu/WSL will not see that Linux environment variable.
You can fix this by using the WSLENV
variable feature of WSL (original devblog announcement with more detail).
That means, for the Windows version of the Android SDK to see ANDROID_SDK_ROOT
, you need to add that variable name to the WSLENV
variable.
For example:
export ANDROID_SDK_ROOT='C:\path\to\SDK\`
export WSLENV="$WSLENV:ANDROID_SDK_ROOT`
While this might solve part of the problem, note that you must use the Windows path format above instead of the WSL/Linux path (/mnt/c/path/...
). This is because you are running a Windows process.
These issues could in theory all be worked around with things like wslpath
, WSLENV
, and other features, but again, for tools like this, I typically would recommend:
- Using the Windows version of the toolchain (editor, commandline, SDK, tools, etc.)
- Or using all-Linux versions of the toolchain.
Mix and match only in (a) simple cases, or (b) if you know how to troubleshoot and solve any issues that come up.