Works with Flutter 3.13 on Windows 11 (with Ubuntu 22.04 on WSL2)
- Install Ubuntu 22.02 on Microsoft Store
- Login Ubuntu
- Install Android-sdk
sudo apt-get update sudo apt-get install android-sdk export ANDROID_HOME=/usr/lib/android-sdk
- Get Java 18 (for some reason cmdline tools don't work with default jre versions that comes pre-packaged in Android-sdk)
sudo apt install -y openjdk-18-jdk
- Install cmdline tools without Android Studio, go here to get latest download link
wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip unzip commandlinetools-linux-10406996_latest.zip sudo chmod -R 777 /usr/lib/android-sdk sudo mkdir --parents "$ANDROID_HOME/cmdline-tools/latest" sudo mv cmdline-tools/* "$ANDROID_HOME/cmdline-tools/latest" export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
- Upgrade build-tools and android sdk version
sdkmanager --install "build-tools;28.0.3" sdkmanager --install "platforms;android-29"
- Uninstall debug app if its already on device
- Follow these steps to allow USB connection into WSL2. Important: If you have Android SDK installed on host machine, make sure ADB is not running, execute
adb kill-server
before hand - Plug in Android mobile device
- Check if ADB / Flutter recognizes (might encouter some authorization issues, just plug out and plug in again, change USB mode to Charge only)
adb devices
flutter devices
- Build and run project
flutter clean
flutter run