"Couldn't start project on Android:" | WSL2 - Windows 10


I have been trying for days to make Expo run a React Native app (w/ react-native-web) on an emulated Android Device (w/ AVD) with WSL2 on Windows 10.
I mainly followed this tutorial to get started.
Unfortunately when I run yarn android, I encounter this error : Couldn't start project on Android:
That’s it, there is no other detail and I don’t know where to search now.
The web version works though.

I will try to be as clear as possible about the configuration I tried to put in place even though I am not very qualified in networking/sysadmin.
To summerize the config / what seems to work now :

My .zshenv file

export JAVA_HOME=/usr/lib/jvm/java-14-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin

export ANDROID_HOME=/home/<myuser>/Android/cmdline-tools/latest
export ANDROID_SDK_ROOT=/home/<myuser>/Android


export WSL_HOST=$(tail -1 /etc/resolv.conf | cut -d' ' -f2)

My ~/Android folder contains the latest commandlinetools-linux-7302050_latest.zip file unziped downloaded here. The env vars previously shown are configured accordingly (I hope so anyways)

When I run adb version, I get the following :

In WSL2 (Ubuntu 20.04) :

Android Debug Bridge version 1.0.41
Version 31.0.2-7242960
Installed as /home/<myuser>/Android/platform-tools/adb

In Powershell :

Android Debug Bridge version 1.0.41
Version 31.0.2-7242960
Installed as C:\Users\<myuser>\AppData\Local\Android\Sdk\platform-tools\adb.exe

The versions are the same (I saw people having problems when it was not the case).

I installed the latest SDK packages (in WSL2) with :
./sdkmanager "platform-tools" "platforms;android-30" "build-tools;30.0.3"

On Powershell, when I run :

adb kill-server
adb -a nodaemon server start

I can see the device I launch in Android Studio in both PowerShell and WSL2 with adb devices

List of devices attached
emulator-5554   device

I also tried with socat running on WSL2 side, but it does not change anything
socat -d -d TCP-LISTEN:5037,reuseaddr,fork TCP:$(cat /etc/resolv.conf | tail -n1 | cut -d " " -f 2):5037

When I run whereis adb on Linux, I get the following :
adb: /mnt/c/Users/<myuser>/AppData/Local/Android/Sdk/platform-tools/adb.exe /home/<myuser>/Android/platform-tools/adb
Could having two paths for adb be the problem ? I guess WSL is putting Windows PATH there automatically

On Linux, I installed openjdk-14-jdk to have a recent version of Java.

On Windows, I configured the firewall to allow adb.exe on all Domain/private/public.

I also tried to reinstall Android Studio as I saw it could fix the problem. No luck.

When I run expo diagnostics, here is the result :

Expo CLI 4.4.3 environment info:
      OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
      Shell: 5.8 - /usr/bin/zsh
      Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
      Yarn: 1.22.10 - ~/.nvm/versions/node/v14.15.1/bin/yarn
      npm: 6.14.8 - ~/.nvm/versions/node/v14.15.1/bin/npm
      expo: ~41.0.1 => 41.0.1
      react: 16.13.1 => 16.13.1
      react-dom: ^16.13.1 => 16.13.1
      react-native: https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz => 0.63.2
      react-native-web: ^0.13.18 => 0.13.18
      expo-cli: 4.4.3
    Expo Workflow: managed

Do you have any idea that could help me resolve this ? Thanks a lot in advance for your help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.