You have two options for setting up the development environment; you can set it up in a container or do a local install.
Container - This method reduces the amount of software installed on your personal computer and reduces issues setting up dev env (such as incompatibility with other software) on different computers. It also makes troubleshooting easier as the dev env will remain consistent across users.
Local - This is the standard method of installation, this project has no dependecies outside of Flutter & Dart, so it is a pretty easy install.
Note: Either way you will have to install an emulator on your machine.
- Install Docker Desktop
- Instructions: https://docs.docker.com/get-docker/
- Docker is free but you may need to register an account to download the software
- For windows you may need to install WSL 2 and ensure that Hyper-V is turned on at the BIOS/UEFI level
- Install an android emulator
- Android Studio (Android Virtual Machine)
- If using a AMD based Windows computer
- you will need to enable "Windows HyperVisor Platform"
- Hyper-V/Virtualisation MUST be ENABLED in bios/uefi for Docker to work
- If using a AMD based Windows computer
- Visual Studio Emulator for Android
- a more lightweight Android emulator, try this if having issues with android studio
- Android Studio (Android Virtual Machine)
- Install VSCode & the "Remote Container" extension (HIGHLY RECOMMENDED)
- but you can install another IDE if you prefer, search for the instructions for enabling docker container dev env for that software - Clone the repository
git clone https://github.com/TechlauncherFireApp/FireApp-Mobile <directory>
- Open the repository in VSCode
- Open the VSCode Command Palette (Ctrl+Shift+P) and type
VSCode Remote Container - Open folder in container
- Select the repository/folder
- "FireApp-Mobile" not the 'fireapp' folder
- Wait for the docker container to build (first time will always take longer but after its built it should load instantly)
Now that the Docker container is established you can use
close connection
- to close the containerOpen folder in container
- to start the container - should automatically get a prompt whenever you open the project.rebuild container
- to recreate the container if you makes changes to the setup (dockerfile.dockerfile)
Connect to emulator:
- Start the emulator on your local machine
- If you are using Android Studio this includes openning Android Studio and starting the emulator from there. See: https://developer.android.com/studio/run/managing-avds
- In the docker container terminal type
adb tcpip 5555
- "Device not found" may pop up - if so you can just ignore it
- Type
adb connect host.docker.internal:5555
- Wait for the emulator to connect - usually you can select it from the bottom right hand corner of VSCode.
- CD into the fireapp dir & run the project using
flutter run
from within the fireapp dir
Note: VSCode Extensions may need to be installed in both the local and container - see the heading "Managing extensions" @ https://code.visualstudio.com/docs/remote/containers for more detail. Does not apply to the Remote Container extension
Connect a physcial Android Device:
- Install
adb
on your local system (with container turned off)- Download platform tools: https://developer.android.com/studio/releases/platform-tools#downloads
- Add its path to your environment variable for easy access
- Enable USB Debugging on your Android device
- Connect the device to your computer over USB
- Run
adb devices
(inside the docker container) to get a list of all connected devices - Get the IP Address of your Android device
- Usually found on your android device under
WiFi Settings -> Advanced
- Usually found on your android device under
- Enter the following commands
adb tcpip 5555
adb connect <Your-Devices-IP-Address>
- Run
adb devices
again, this time the IP Address should come up - Disconnect the device and run
adb devices
again, to verify if device is still connected wirelessly - Turn on the docker container
- Then run the following commands
adb connect <IP-Address>:5555
adb devices
- Allow USB debugging when it pops up on your device
- if you encounter 'device unauthorised' run
adb kill-server
adb connect <IP-Address>:5555
adb devices
- Run
Fflutter doctor
to check if device is recognised by flutte
Steps to setup WiFi/USB sync with Android Devicehttps://blog.codemagic.io/how-to-dockerize-flutter-apps/
For Docker to work & for the Android emulator to work, Virtualisation MUST BE ENABLED.
- https://support.microsoft.com/en-us/windows/enable-virtualization-on-windows-11-pcs-c5578302-6e43-4b4b-a449-8ced115f58e1
- Needs to be enabled in your bios
- If Docker works but the Android emulator gives the error "Hyper-V must be disabled" - do not disable Hyper-V instead on the windows search bar search for "Windows features" or 'Turn windows features on or off" and ensure that Virtual Machine Platform & Windows Hypervisor Platform are turned on.
To emulate iOS you will have to install Flutter locally on a MacOS Machine. ARM-based Macs (models released 2021 and after) at this point in time (2022) can't emulate android
Step 1: Simply follow these instructions to install flutter from the Flutter website: https://docs.flutter.dev/get-started/install for installation instructions for Flutter & Emulators Note that if you are on MacOS and want to use the iOS emulator (required if you have an ARM-based mac) then you will need to install XCode from Apple (available on the Mac App Store).
Step 2: Install and setup an IDE (if not already installed) See: https://docs.flutter.dev/get-started/editor (This link includes instructions for setting up Android Studio, IntelliJ and/or VSCode as your main flutter IDE)
Step 3: Clone the repository