Absolutely! Testing your Flutter app on an emulator in Debian (or any Linux distro) is a common workflow. Here’s a step-by-step guide to get you started:
1. Install Android Studio (for Android Emulator)
While you can use VSCode for Flutter development, the Android Emulator comes with Android Studio. You don’t need to use Android Studio as your main editor, but you need it for the emulator.
a. Download Android Studio:
b. Extract and Install:
bash Copy code
tar -xzvf android-studio-*.tar.gz
cd android-studio/bin
./studio.sh
c. Follow the setup wizard to install the Android SDK and create a virtual device (emulator).
2. Set Up Android Emulator
Open Android Studio.
Go to Tools > Device Manager .
Click Create Device and follow the prompts to set up a virtual device (e.g., Pixel 4, Android 13).
Download a system image if prompted.
Once created, click the Play button to start the emulator.
3. Add Android SDK to PATH
Add these lines to your ~/.bashrc or ~/.zshrc (adjust the path if your SDK is elsewhere):
bash Copy code
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Then run:
bash Copy code
source ~/.bashrc
4. Check Flutter Devices
In your terminal, run:
bash Copy code
flutter devices
You should see your emulator listed. If not, make sure the emulator is running.
5. Run Your App
From your project directory, run:
Or, in VSCode:
Open the command palette (Ctrl+Shift+P).
Type Flutter: Select Device and choose your emulator.
Then run your app (F5 or Flutter: Run).
6. Troubleshooting
If you get No devices found, make sure the emulator is running and your PATH is set correctly.
You may need to install libvirt and qemu if you get virtualization errors:
bash Copy code
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
7. (Optional) iOS Emulation
iOS emulators are only available on macOS. On Linux, you can only emulate Android devices.
Summary:
Install Android Studio (for the emulator).
Create and start an emulator.
Make sure your PATH is set.
Use flutter run or VSCode to launch your app on the emulator.
Let me know if you need help with any step!