flutter安装 android studio,windows

mac环境下几个注意点:
报错: CocoaPods installed but not initialized

#安装cocoapods
$ sudo gem install cocoapods -v 1.7.5  
$ pod setup 下载太慢了.切换国内下载源
$ cd ~/.cocoapods/repos
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master

报错: Waiting for another flutter command to release the startup lock

$ rm -f ${flutterROOT}/bin/cache/lockfile
准备环境2:

windows环境

  1. 下载flutter

https://storage.googleapis.com/flutter_infra/releases/stable/windows/flutter_windows_v1.12.13+hotfix.9-stable.zip

  1. 下载android安装包,并完成安装工作
  2. 解压flutter安装包,

到相应目录,把当前目前添加系统环境变量path中,并且新建模拟器准备好

  1. 命令行 $flutter doctor
    显示一堆的叉叉,接下来开始解决叉叉

Q1: Some Android licenses not accepted
A:运行 $ flutter doctor --android-licenses 即可
Q2: 显示X Unable to locate Android SDK
A: android studio的环境变量 ANDROID_HOME 未配置(也就是安装studio时设置的SDK目录)
Q3: Flutter plugin not installed
A: Android studio安装flutter插件第一步:file ——》settings ——》Plugins ,搜索flutter;点击Install进行安装,安装过程中会有弹出窗口提示是否安装Dart,勾选安装Dart

最后再运行
$ flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.2)
[!] Connected device
    ! No devices available
  1. vscode 运行项目
    设置-> Command Palete -> $flutter -> new project
[first_app] flutter create --ios-language swift --android-language kotlin .
Waiting for another flutter command to release the startup lock...
Creating project .... androidx: true
  .gitignore (created)
  .idea\libraries\Dart_SDK.xml (created)
  .idea\libraries\Flutter_for_Android.xml (created)
  .idea\libraries\KotlinJavaRuntime.xml (created)
  .idea\modules.xml (created)
  .idea\runConfigurations\main_dart.xml (created)
  .idea\workspace.xml (created)
  .metadata (created)
  android\app\build.gradle (created)
  android\app\src\main\kotlin\com\example\first_app\MainActivity.kt (created)
  android\build.gradle (created)
  android\first_app_android.iml (created)
  android\.gitignore (created)
  android\app\src\debug\AndroidManifest.xml (created)
  android\app\src\main\AndroidManifest.xml (created)
  android\app\src\main\res\drawable\launch_background.xml (created)
  android\app\src\main\res\mipmap-hdpi\ic_launcher.png (created)
  android\app\src\main\res\mipmap-mdpi\ic_launcher.png (created)
  android\app\src\main\res\mipmap-xhdpi\ic_launcher.png (created)
  android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png (created)
  android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png (created)
  android\app\src\main\res\values\styles.xml (created)
  android\app\src\profile\AndroidManifest.xml (created)
  android\gradle\wrapper\gradle-wrapper.properties (created)
  android\gradle.properties (created)
  android\settings.gradle (created)
  ios\Runner\AppDelegate.swift (created)
  ios\Runner\Runner-Bridging-Header.h (created)
  ios\Runner.xcodeproj\project.pbxproj (created)
  ios\Runner.xcodeproj\xcshareddata\xcschemes\Runner.xcscheme (created)
  ios\.gitignore (created)
  ios\Flutter\AppFrameworkInfo.plist (created)
  ios\Flutter\Debug.xcconfig (created)
  ios\Flutter\Release.xcconfig (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Contents.json (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-1024x1024@1x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@1x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@2x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-20x20@3x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@1x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@2x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-29x29@3x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@1x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@2x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-40x40@3x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-60x60@2x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-60x60@3x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-76x76@1x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-76x76@2x.png (created)
  ios\Runner\Assets.xcassets\AppIcon.appiconset\Icon-App-83.5x83.5@2x.png (created)
  ios\Runner\Assets.xcassets\LaunchImage.imageset\Contents.json (created)
  ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage.png (created)
  ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage@2x.png (created)
  ios\Runner\Assets.xcassets\LaunchImage.imageset\LaunchImage@3x.png (created)
  ios\Runner\Assets.xcassets\LaunchImage.imageset\README.md (created)
  ios\Runner\Base.lproj\LaunchScreen.storyboard (created)
  ios\Runner\Base.lproj\Main.storyboard (created)
  ios\Runner\Info.plist (created)
  ios\Runner.xcodeproj\project.xcworkspace\contents.xcworkspacedata (created)
  ios\Runner.xcworkspace\contents.xcworkspacedata (created)
  lib\main.dart (created)
  first_app.iml (created)
  pubspec.yaml (created)
  README.md (created)
  test\widget_test.dart (created)
Running "flutter pub get" in first_app...                          96.2s
Wrote 68 files.

All done!
[√] Flutter: is fully installed. (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Android Studio: is fully installed. (version 3.2)
[!] Connected device: is not available.

Run "flutter doctor" for information about installing additional components.

In order to run your application, type:

  $ cd .
  $ flutter run

Your application code is in .\lib\main.dart.

exit code 0
  1. 设置国内镜像

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.2)
[√] Connected device (1 available)

• No issues found!
  1. 首次运行app,

等了将近二十分钟,才build成功,中间各种改gradle的镜像地址,好像没起作用

https://blog.csdn.net/weixin_38166686/article/details/102170136 gradle镜像地址

修正 :
运行如下命令,可以看到配置的gradle镜像地址生效了,慢还是慢了点,不过总归是正常了

$ flutter run -v 

PS: 请耐心等待
Launching lib\main.dart on AOSP on IA Emulator in debug mode…
Running Gradle task ‘assembleDebug’.

PS: 完成后显示如下,运行成功了

Launching lib\main.dart on AOSP on IA Emulator in debug mode...
√ Built build\app\outputs\apk\debug\app-debug.apk.
D/FlutterActivity( 6301): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate( 6301): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate( 6301): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
D/FlutterActivityAndFragmentDelegate( 6301): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView( 6301): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@d3dd791
D/FlutterActivityAndFragmentDelegate( 6301): Executing Dart entrypoint: main, and sending initial route: /
I/OpenGLRenderer( 6301): Initialized EGL, version 1.4
D/OpenGLRenderer( 6301): Swap behavior 1
D/HostConnection( 6301): HostConnection::get() New Host Connection established 0xe9d27170, tid 6348
D/HostConnection( 6301): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
W/OpenGLRenderer( 6301): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer( 6301): Swap behavior 0
D/eglCodecCommon( 6301): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation( 6301): eglCreateContext: 0xe8b64340: maj 3 min 0 rcv 3
D/EGL_emulation( 6301): eglMakeCurrent: 0xe8b64340: ver 3 0 (tinfo 0xe8b665b0)
D/HostConnection( 6301): HostConnection::get() New Host Connection established 0xeb53c140, tid 6335
D/HostConnection( 6301): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
D/eglCodecCommon( 6301): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation( 6301): eglCreateContext: 0xeb505420: maj 3 min 0 rcv 3
D/HostConnection( 6301): createUnique: call
D/HostConnection( 6301): createUnique: call
D/HostConnection( 6301): HostConnection::get() New Host Connection established 0xeb53c190, tid 6335
D/HostConnection( 6301): HostConnection::get() New Host Connection established 0xe9d293d0, tid 6348
D/HostConnection( 6301): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
E/eglCodecCommon( 6301): GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
D/HostConnection( 6301): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0
D/EGL_emulation( 6301): eglMakeCurrent: 0xeb505420: ver 3 0 (tinfo 0xeb5033d0)
I/Choreographer( 6301): Skipped 73 frames!  The application may be doing too much work on its main thread.
D/EGL_emulation( 6301): eglMakeCurrent: 0xe8b64340: ver 3 0 (tinfo 0xe8b665b0)
D/eglCodecCommon( 6301): setVertexArrayObject: set vao to 0 (0) 1 2
I/OpenGLRenderer( 6301): Davey! duration=1721ms; Flags=1, IntendedVsync=2548965940924, Vsync=2550182607542, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=2550192064810, AnimationStart=2550192209170, PerformTraversalsStart=2550201986470, DrawStart=2550238378650, SyncQueued=2550239105390, SyncStart=2550241837040, IssueDrawCommandsStart=2550244801880, SwapBuffers=2550267366040, FrameCompleted=2550689735110, DequeueBufferDuration=314898000, QueueBufferDuration=82137000,
D/EGL_emulation( 6301): eglMakeCurrent: 0xeb505420: ver 3 0 (tinfo 0xeb5033d0)
D/eglCodecCommon( 6301): setVertexArrayObject: set vao to 0 (0) 1 0
  1. 导入已有的项目

$ flutter pub get
$ flutter run -v
问题一:
因为项目引入其它项目(plugins\xxx_xxx)
pubspec.lock文件里引了如下的一个外部项目,需要把这个项目拉下来到plugins/目录下

packages:
  xxx_xxx:
    dependency: "direct main"
    description:
      path: "plugins\\xxx_xxx"
      relative: true
    source: path
    version: "0.0.1"

问题二:
Error: ADB exited with exit code 1
Performing Streamed Install

贴人家的地址,就是模拟器的usb调试模式的问题

https://www.cnblogs.com/skygxk/p/12371215.html

问题三:

FAILURE: Build failed with an exception.
* Where:
Build file 'D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\connectivity_macos-0.1.0+2\android\build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'connectivity'.
> Failed to apply plugin [id 'com.android.library']
    > Minimum supported Gradle version is 5.4.1. Current version is 4.10.2. If using the gradle wrapper, try editing the distributionUrl in
    D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\connectivity_macos-0.1.0+2\android\gradle\wrapper\gradle-wrapper.properties to gradle-5.4.1-all.zip

切换到flutter目录下
${FLUTTER_ROOT}.pub-cache\hosted\pub.flutter-io.cn\connectivity_macos-0.1.0+2\android\build.gradle
修改gradle版本

问题四:

D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\flutter_plugin_android_lifecycle-1.0.7\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:8: 错误:
程序包androidx.lifecycle不存在
           import androidx.lifecycle.Lifecycle;
                                    ^
           D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\flutter_plugin_android_lifecycle-1.0.7\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:2
           2: 错误: 找不到符号
             public static Lifecycle getActivityLifecycle(
                           ^
             符号:   类 Lifecycle
             位置: 类 FlutterLifecycleAdapter
           2 个错误

切换到项目目录下
${PROJECT_ROOT}/android/app/build.gradle
添加如下内容

configurations.all {
    resolutionStrategy {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'androidx.core') {
                details.useVersion "1.0.2"
            }
            if (details.requested.group == 'androidx.lifecycle') {
                details.useVersion "2.0.0"
            }
            if (details.requested.group == 'androidx.versionedparcelable') {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.fragment') {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.appcompat') {
                details.useVersion "1.0.1"
            }
        }
    }
}

贴人家的地址

https://blog.csdn.net/luoboo525/article/details/104192243

最后运行结果:

$ flutter run
Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...                             26.0s
√ Built build\app\outputs\apk\debug\app-debug.apk.
Syncing files to device sdk gphone x86...
I/n.meyoung.mytm( 7083): Background young concurrent copying GC freed 16508(1233KB) AllocSpace objects, 1(20KB) LOS objects, 95% free, 1149KB/25MB, paused 12.287ms total 56.092ms
D/EGL_emulation( 7083): eglMakeCurrent: 0xef467060: ver 3 0 (tinfo 0xef4fa5b0)
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
I/flutter ( 7083): null
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
I/flutter ( 7083): http post: http://127.0.0.1:8080/app, {type: 1, fromapp: 1}
I/flutter ( 7083): {code: 0, message: success, result: {version: 2.0.0, remark: APP

I/flutter ( 7083): , url: http://127.0.0.1:8081/file/apk/app-release.apk, created: 2019-11-12T06:21:27Z}}
Syncing files to device sdk gphone x86...                        8,123ms (!)

🔥  To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
An Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:64689/ELA99duIvcQ=/
For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".
PS: 按q退出

D/skia    ( 7083): Shader compilation error
D/skia    ( 7083): ------------------------
D/skia    ( 7083): Errors:
D/skia    ( 7083):
D/EGL_emulation( 7083): eglMakeCurrent: 0xef465620: ver 3 0 (tinfo 0xef4fe770)
W/System  ( 7083): A resource failed to call release.
I/chatty  ( 7083): uid=10148(cn.meyoung.mytms) FinalizerDaemon identical 2 lines
W/System  ( 7083): A resource failed to call release.

Application finished.

再推荐两篇文章
源码解读Flutter run机制
Flutter 内幕:Flutter 在内部是如何工作的?
最后还得感谢github,stackoverflow
https://github.com
https://stackoverflow.com

PS: flutter是个坑

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 1. 下载Flutter SDK:从Flutter官网下载最新的Flutter SDK,解压到你想要安装的目录下。 2. 配置环境变量:将Flutter SDK的bin目录添加到系统环境变量中,这样就可以在任何地方使用Flutter命令了。 3. 安装Android StudioFlutter需要依赖Android Studio来进行开发,所以需要先安装Android Studio。 4. 安装Flutter插件:在Android Studio安装Flutter插件,这样就可以在Android Studio中创建Flutter项目了。 5. 创建Flutter项目:在Android Studio中创建Flutter项目,选择Flutter应用程序模板,然后按照提示进行操作即可。 6. 运行Flutter项目:在Android Studio中运行Flutter项目,选择模拟器或真机进行测试。 7. 安装Flutter插件:在Android Studio安装Flutter插件,这样就可以在Android Studio中创建Flutter项目了。 8. 创建Flutter项目:在Android Studio中创建Flutter项目,选择Flutter应用程序模板,然后按照提示进行操作即可。 9. 运行Flutter项目:在Android Studio中运行Flutter项目,选择模拟器或真机进行测试。 ### 回答2: Flutter 是 Google 推出的一款移动应用开发框架,支持 Android、iOS、Web、Windows 等多个平台。在 Windows 平台上,安装和配置 Flutter 并开发应用也十分方便。 一、安装 Flutter 1. 下载 Flutter SDK 你可以在 Flutter 的官网上下载 Flutter SDK。下载完成后,解压到你想要安装的目录下。 2. 配置环境变量 将 flutter安装目录设置到系统环境变量 Path 中,以便在终端中运行 flutter 命令。 二、安装 Dart 因为 Flutter 是用 Dart 语言开发的,所以需要先安装 Dart SDK。你也可以在 Flutter 的官网中找到下载链接,并安装到本地。 三、配置 Android Studio 1. 安装 Android Studio 你可以在官网上下载 Android Studio安装包,安装完成后会自动创建一个新的项目。 2. 安装 Flutter 插件 在 Android Studio 中按下 Ctrl + Alt + S 打开设置,依次点击 Plugins → Browse repositories,直到搜索到 Flutter 插件,点击安装即可。 3. 配置 SDK 点击 File → Settings → Appearance & Behavior → System Settings → Android SDK,在这个界面中配置 Android SDK。 四、创建 Flutter 应用 1. 创建新项目 在 Android Studio 中点击 File → New → New Flutter Project,进入创建新项目的命令面板,其中包括选择项目类型、配置名称和位置等。 2. 运行代码 创建完毕后,就可以运行代码了,如果需要运行 iOS 应用,则需要在 Mac 电脑上进行编译。 以上就是在 Windows 系统上安装和配置 Flutter 的方法,如果想要开发 Flutter 应用,只需要按照这个流程进行即可。当然,如果您对环境配置比较熟练,也可以直接使用 Flutter 的命令行工具进行开发。 ### 回答3: Flutter是一种跨平台的移动应用程序开发框架,可以用于在多个平台进行应用程序开发。Flutter支持Windows平台开发,并且可以在Windows系统上进行安装和配置。 Flutter安装和配置Windows系统的步骤如下: 第一步:安装Flutter SDK 在安装Flutter SDK之前,需要安装Git和Android Studio。打开Flutter官方网站 https://flutter.dev/docs/get-started/install/windows,下载Flutter SDK,并将其解压缩到合适的位置。注意:为了方便,可以把Flutter的路径加入环境变量。 第二步:配置Flutter环境 在Windows系统中使用Flutter,必须配置Flutter的环境变量。 需要添加Flutter的bin文件夹路径到PATH环境变量中。 例如,如果Flutter安装在C:\sdk文件夹中,则需将C:\sdk\flutter\bin添加到PATH环境变量中,这样你就可以从命令行启动Flutter相关工具了。 第三步:安装依赖项 Flutter需要一些依赖项来运行。你可以通过在命令行窗口中输入以下命令来安装这些依赖项: flutter doctor 该命令会查找缺少的依赖项,并提供有关如何解决这些问题的说明。 第四步:配置Android Studio 为了在Windows系统中使用Flutter,你需要配置Android Studio。 1.启动Android Studio。 2.从“配置”菜单中选择“插件”。 3.在弹出的窗口中,搜索并找到Flutter插件。点击“安装”。 4.安装之后,点击“重启Android Studio”使Flutter插件生效。 第五步:配置设备 在Windows上运行Flutter应用程序,你需要一个Android模拟器或连接的硬件设备。 1.通过启动Android Studio,并选择“AVD Manager”来配置模拟器。 2.在“AVD Manager”中,点击“Create Virtual Device”。 3.选择一个映像文件,并设置其他选项。 4.启动模拟器,并将其作为设备使用。 现在,在Windows系统中已安装并配置了Flutter SDK,配置设备,并准备好使用它了。你可以通过启动Android Studio,并创建一个Flutter项目来开始使用Flutter。 总而言之,以上是Flutter安装配置windows的步骤。如果你愿意,在这一过程中,你也可以了解更多与Flutter相关的知识。希望这篇文章能够对大家有所帮助!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值