Prerequisites
Before the install/build steps below, make sure your host and any physical test devices are set up. For emulator/simulator-only work you can skip the device sections.
Host toolchain
| You want to build for⦠| You need |
|---|---|
| Android (any OS) | Android Studio or the Android command-line tools (SDK + platform-tools), plus a JDK 17+ |
| iOS (macOS only) | The full Xcode app from the App Store, not just the standalone Command Line Tools |
| Appium/WebdriverIO automation (optional) | Node.js 18+ (only if you use the Appium harnesses or automation/appium/) |
Android needs a JDK (17+): Gradle won’t build without one. Android Studio bundles a suitable runtime, but if you installed only the command-line tools, install a JDK and point
JAVA_HOMEat it. On macOS a barejavaonPATHis just a stub, setJAVA_HOMEto a real JDK.macOS (Homebrew):
Debian/Ubuntu:
Windows (winget):
Point your shell at the SDK + JDK (
ANDROID_HOME/JAVA_HOME). If you installed the command-line tools only (no Android Studio), your shell needs three things soadb,emulator,sdkmanager, and Gradle can find the SDK and a real JDK:ANDROID_HOME,JAVA_HOME, and both onPATH. (Android Studio setsANDROID_HOMEfor you; a Homebrewopenjdkstill needsJAVA_HOME.) Verify withflutter doctor, a green Android toolchain means these are set. The Appium harnesses (automation/scripts/appium_run_*.sh,verify_all_modules.sh) auto-resolve all of this, so you only need these exports for the manualadb/emulator/./gradlewcommands.Add the block for your shell to its startup file so it persists across sessions (adjust the SDK path, Homebrew’s is shown; Android Studio installs to
~/Library/Android/sdkon macOS,~/Android/Sdkon Linux):macOS (zsh, the default; appends to
~/.zshrc):Linux (bash, appends to
~/.bashrc; use~/.profilefor login shells):Windows (PowerShell, persists to your user environment):
Xcode vs. “Command Line Tools”:
xcode-select --installinstalls only the standalone CLT (git, clang, etc.). That is not enough to build or deploy an iOS app, building for a device/simulator requires the full Xcode app plus its bundled SDKs. After installing Xcode, point the toolchain at it and accept the licenses (macOS steps are in Installing Flutter):iOS development is macOS-only, Xcode does not exist for Windows or Linux.
Node.js (only for Appium automation): the UI-automation harnesses (
automation/scripts/appium_run_*.sh) and theautomation/appium/suite run on Node. Skip this if you’re only building/running the app by hand.macOS (Homebrew):
Debian/Ubuntu:
Windows (winget):
Run flutter doctor after setup; it flags anything missing for the platforms you
plan to target.
Android device (physical)
- Enable Developer options: Settings β About phone β tap Build number 7Γ.
- Settings β System β Developer options β turn on USB debugging.
- Connect over USB and accept the “Allow USB debugging?” RSA prompt on the phone (tick “Always allow from this computer”). Re-accept if you switch cables or ports.
- Verify the host sees it:
adb devicesshould list the serial asdevice(notunauthorizedoroffline). If it flaps, try a different cable/port andadb kill-server && adb start-server.
iOS device (physical)
- Developer Mode (iOS 16+): Settings β Privacy & Security β Developer Mode β enable, then reboot. A signed build installs but won’t launch without this.
- Connect over USB and tap Trust This Computer on the iPhone.
- Signing: open
ios/Runner.xcworkspacein Xcode β Signing & Capabilities β pick your Team (a free Apple ID works). Unsigned builds won’t install on a device; the Simulator needs no signing. - Free Apple ID provisioning expires after 7 days, re-deploy weekly for ongoing testing. (A paid Apple Developer account lasts a year.)
Install fails with
0xe8008018(“identity β¦ no longer valid”)? The cert looks valid locally but Apple has revoked it server-side (common with free “Personal Team” certs). No CLI tool can re-mint it - you must let Xcode’s automatic signing regenerate the cert via Fix Issue. Full step-by-step is in the "β οΈ Install fails with0xe8008018" box on the iOS install page.
Finding your Team ID. “Team” in Xcode maps to a 10-character Apple Team ID. Don’t hardcode someone else’s, use your own. Add your Apple ID under Xcode β Settings β Accounts first, then either pick the Team in Signing & Capabilities or set it via the xcconfig below. To look yours up from the CLI:
If neither returns anything, you haven’t signed a build yet, add your account in Xcode and let it create a profile once, then re-run.
Set your Team via the local xcconfig (keeps IDs out of git). The Xcode project references
DEVELOPMENT_TEAM = $(DEVELOPMENT_TEAM), resolved from a gitignoredios/Flutter/Signing.xcconfig. One-time setup:
Signing.xcconfigis gitignored, so each contributor uses their own team and nobody’s ID is committed. (Simulator builds need no signing, so this is only required for on-device builds.)
Seeing the stock “Flutter Demo Home Page” counter instead of DVMA? That means Xcode built a Flutter config pointing at the wrong project (a stale
ios/Flutter/Generated.xcconfig, e.g. copied from aflutter createscaffold, sends the build to a differentlib/main.dart). Regenerate the iOS build config for this repo, then clean-build:Then in Xcode: Product β Clean Build Folder (β§βK) and Run. Always open the
.xcworkspace, never the.xcodeproj.