リリース・改善中
Flutter ガイド · 6/6
この章は現在、英語でのみ提供しています。
During development, flutter run uses debug mode with hot reload. For release you build in release mode, where Dart code is compiled ahead of time to native machine code (or to JavaScript or WebAssembly on the web), producing smaller and faster apps. This chapter covers per-platform build commands, versioning, signing and store releases.
| Command | Output | Used for |
|---|---|---|
flutter build apk | .apk | Direct distribution, test installs |
flutter build appbundle | .aab | Google Play |
flutter build ipa | .ipa (plus an Xcode archive) | App Store, TestFlight |
flutter build web | Static files in build/web | Web hosting |
flutter build windows | Executable and DLL folder | Windows distribution |
flutter build macos | .app | macOS distribution |
flutter build linux | Executable bundle | Linux distribution |
flutter build defaults to release mode and writes output under build, in a platform-specific location. Each target must be built on its own OS: iOS and macOS on a Mac, Windows on Windows.
# Android: App Bundle for the Play Store
flutter build appbundle
# Android: one APK per ABI (smaller files)
flutter build apk --split-per-abi
# Web: deploying under a sub-path
flutter build web --base-href /myapp/
# Try release mode on a device
flutter run --releaseThe app version lives in one place: version in pubspec.yaml. For 1.2.0+5, the user-facing version name is 1.2.0 and the build number the stores use is 5. Increase the build number for every upload; you can also override both at build time:
flutter build appbundle --build-name=1.2.1 --build-number=6Google Play requires builds signed with an upload key. Create a keystore with Java's keytool:
keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA \
-keysize 2048 -validity 10000 -alias uploadPut the passwords and keystore path in , and . Then read those values in and attach the signing config to the release build:
android/key.propertiesandroid/app/build.gradle.ktsimport java.io.FileInputStream
import java.util.Properties
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
android {
// ...
signingConfigs {
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"] as String
}
}
buildTypes {
release {
signingConfig = signingConfigs.getByName("release")
}
}
}With Play App Signing, Google stores the app signing key and you only manage the upload key. Before release, double-check the applicationId, app name, icon and requested permissions.
Publishing to the App Store requires membership in the Apple Developer Program.
ios/Runner.xcworkspace in Xcode and set the team and bundle identifier under Signing & Capabilities.flutter build ipa. Output goes to build/ios/ipa and build/ios/archive.The web build in build/web is a set of static files, so any static host works: Firebase Hosting, GitHub Pages, Nginx and so on. If the app uses in-app paths, configure the server to serve index.html for every route.
The Windows build lands in build/windows/x64/runner/Release; ship the executable together with its DLLs and the data folder. The msix package can produce an MSIX installer for the Microsoft Store. macOS apps are signed in Xcode and notarized before distribution.
Release builds for Android, iOS and desktop can obfuscate Dart code. Keep the generated symbol files; you need them to read crash stack traces.
flutter build appbundle --obfuscate --split-debug-info=build/symbolsBefore shipping, check:
flutter run --release)flutter_launcher_icons help)flutter analyze and flutter test both passflutter build <target>.version (name plus build number) in pubspec.yaml.flutter build ipa.Learn more in the official documentation:
コメント 0件
ログイン · ログインするとコメントできます。
最初のコメントを書いてみましょう。