1.创建 Flutter 工程
flutter create
D:\notebook\flutter\projects\ui_tutorial\layout>flutter create layout_app Creating project layout_app... layout_app\.gitignore (created) layout_app\.idea\libraries\Dart_SDK.xml (created) layout_app\.idea\libraries\Flutter_for_Android.xml (created) layout_app\.idea\libraries\KotlinJavaRuntime.xml (created) layout_app\.idea\modules.xml (created) layout_app\.idea\runConfigurations\main_dart.xml (created) layout_app\.idea\workspace.xml (created) layout_app\.metadata (created) layout_app\android\app\build.gradle (created) layout_app\android\app\src\main\java\com\example\layout_app\MainActivity.java (created) layout_app\android\build.gradle (created) layout_app\android\layout_app_android.iml (created) layout_app\android\app\src\debug\AndroidManifest.xml (created) layout_app\android\app\src\main\AndroidManifest.xml (created) layout_app\android\app\src\main\res\drawable\launch_background.xml (created) layout_app\android\app\src\main\res\mipmap-hdpi\ic_launcher.png (created) layout_app\android\app\src\main\res\mipmap-mdpi\ic_launcher.png (created) layout_app\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png (created) layout_app\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png (created) layout_app\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png (created) layout_app\android\app\src\main\res\values\styles.xml (created) layout_app\android\app\src\profile\AndroidManifest.xml (created) layout_app\android\gradle\wrapper\gradle-wrapper.properties (created) layout_app\android\gradle.properties (created) layout_app\android\settings.gradle (created) layout_app\ios\Runner\AppDelegate.h (created) layout_app\ios\Runner\AppDelegate.m (created) layout_app\ios\Runner\main.m (created) layout_app\ios\Runner.xcodeproj\project.pbxproj (created) layout_app\ios\Runner.xcodeproj\xcshareddata\xcschemes\Runner.xcscheme (created) layout_app\ios\Flutter\AppFrameworkInfo.plist (created) layout_app\ios\Flutter\Debug.xcconfig (created) layout_app\ios\Flutter\Release.xcconfig (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Contents.json (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-1024x1024@1x .png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@1x.png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@2x.png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@3x.png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-[email protected] (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-[email protected] (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-[email protected] (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@1x.png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@2x.png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@3x.png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-60x60@2x.png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-60x60@3x.png (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-[email protected] (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-[email protected] (created) layout_app\ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-83.5x83.5@2x .png (created) layout_app\ios\Runner\Assets.xcassets\LaunchImage.imageset\Contents.json (created) layout_app\ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage.png (created) layout_app\ios\Runner\Assets.xcassets\LaunchImage.imageset\[email protected] (created) layout_app\ios\Runner\Assets.xcassets\LaunchImage.imageset\[email protected] (created) layout_app\ios\Runner\Assets.xcassets\LaunchImage.imageset\README.md (created) layout_app\ios\Runner\Base.lproj\LaunchScreen.storyboard (created) layout_app\ios\Runner\Base.lproj\Main.storyboard (created) layout_app\ios\Runner\Info.plist (created) layout_app\ios\Runner.xcodeproj\project.xcworkspace\contents.xcworkspacedata (created) layout_app\ios\Runner.xcworkspace\contents.xcworkspacedata (created) layout_app\lib\main.dart (created) layout_app\layout_app.iml (created) layout_app\pubspec.yaml (created) layout_app\README.md (created) layout_app\test\widget_test.dart (created) Running "flutter packages get" in layout_app... 8.1s Wrote 66 files. All done! [√] Flutter is fully installed. (Channel beta, v1.2.1, on Microsoft Windows [Version 6.1.7601], locale zh-CN) [√] Android toolchain - develop for Android devices is fully installed. (Android SDK version 28.0.3) [!] Android Studio is not available. (not installed) [!] Connected device is not available. Run "flutter doctor" for information about installing additional components. In order to run your application, type: $ cd layout_app $ flutter run Your application code is in layout_app\lib\main.dart. D:\notebook\flutter\projects\ui_tutorial\layout>
2. Flutter 编译 apk
flutter build [apk]
D:\notebook\flutter\projects\ui_tutorial\layout>cd layout_app D:\notebook\flutter\projects\ui_tutorial\layout\layout_app>flutter build Flutter build commands. Usage: flutter build[arguments] -h, --help Print this usage information. Available subcommands: aot Build an ahead-of-time compiled snapshot of your app's Dart code. apk Build an Android APK file from your app. appbundle Build an Android App Bundle file from your app. bundle Build the Flutter assets directory from your app. flx Deprecated ios Build an iOS application bundle (Mac OS X host only). Run "flutter help" to see global options. D:\notebook\flutter\projects\ui_tutorial\layout\layout_app>flutter build apk Initializing gradle... 5.3s Resolving dependencies... 47.5s Running Gradle task 'assembleRelease'... Calling mockable JAR artifact transform to create file: C:\Users\Administrator\. gradle\caches\transforms-1\files-1.1\android.jar\9af1ff324598fa2d595c0bf1564a0c1 5\android.jar with input D:\softs\Android\android-sdk\platforms\android-28\andro id.jar Running Gradle task 'assembleRelease'... 395.9s (!) Built build\app\outputs\apk\release\app-release.apk (4.8MB). D:\notebook\flutter\projects\ui_tutorial\layout\layout_app>