Flutter环境配置

Flutter在vscode下的环境配置


去flutter官网下载flutter的SDK

下载完成后,终端输入如下命令:

cp -r /Users/xx/Downloads/flutter /Users/xx
vim $HOME/.bash_profile

bash_profile文件内容如下:

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/xx/flutter/bin:$PATH

这样flutter的SDK就安装在*/Users/xx/*目录下了:

然后执行:

flutter doctor

执行结果如下:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.14.4 18E226, locale
zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
[✓] iOS tools - develop for iOS devices
[!] Android Studio (version 3.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.36.1)
[✓] Connected device (2 available)

如果没有进行过配置项的,前面会显示如下:

[✗] iOS tools - develop for iOS devices
✗ libimobiledevice and ideviceinstaller are not installed. To install with
Brew, run:
brew update
brew install --HEAD usbmuxd
brew link usbmuxd (brew unlink usbmuxd && brew link usbmuxd)
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
! Brew can be used to install tools for iOS device development.
Download brew at https://brew.sh/.

Xcode的配置:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Homebrew的配置,需先安装:

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

之后下载:

brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
brew install ios-deploy

这样就配置OK了。

之后可以调取如下命令:

open -a Simulator
cd /Users/xx/Desktop/flutterDemo
flutter create helloapp

之后命令行会自动执行一系列创建工程操作 :

Creating project helloapp…
helloapp/ios/Runner.xcworkspace/contents.xcworkspacedata (created)
helloapp/ios/Runner/Info.plist (created)
helloapp/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
(created)
helloapp/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
。。。。。
helloapp/.metadata (created)
helloapp/ios/Runner/AppDelegate.h (created)
helloapp/ios/Runner/main.m (created)
helloapp/ios/Runner/AppDelegate.m (created)
helloapp/ios/Runner.xcodeproj/project.pbxproj (created)
helloapp/android/app/src/profile/AndroidManifest.xml (created)
helloapp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png (created)
helloapp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png (created)
helloapp/android/app/src/main/res/drawable/launch_background.xml (created)
helloapp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png (created)
helloapp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png (created)
helloapp/android/app/src/main/res/values/styles.xml (created)
helloapp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png (created)
helloapp/android/app/src/main/AndroidManifest.xml (created)
helloapp/android/app/src/debug/AndroidManifest.xml (created)
。。。。。。。
helloapp/android/build.gradle (created)
helloapp/android/helloapp_android.iml (created)
helloapp/.idea/runConfigurations/main_dart.xml (created)
helloapp/.idea/libraries/Flutter_for_Android.xml (created)
helloapp/.idea/libraries/Dart_SDK.xml (created)
helloapp/.idea/libraries/KotlinJavaRuntime.xml (created)
helloapp/.idea/modules.xml (created)
helloapp/.idea/workspace.xml (created)
Running “flutter pub get” in helloapp… 1.2s
Wrote 66 files.
。。。。。。。。
All done!
[✓] Flutter is fully installed. (Channel stable, v1.7.8+hotfix.3, on Mac OS X
10.14.4 18E226, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices is fully installed. (Android
SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS is fully installed. (Xcode 10.2.1)
[✓] iOS tools - develop for iOS devices is fully installed.
[!] Android Studio is partially installed; more components are available.
(version 3.4)
[✓] VS Code is fully installed. (version 1.36.1)
[✓] Connected device is fully installed. (3 available)
Run “flutter doctor” for information about installing additional components.

In order to run your application, type:
$ cd helloapp
$ flutter run
Your application code is in helloapp/lib/main.dart.

之后执行一下:

cd helloapp
flutter run

显示结果如下:
在这里插入图片描述

好了,就此一个flutter项目开启了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值