Flutter开发之爬坑集合(五)

Flutter基础篇(4)-- Flutter填坑全面总结
https://www.jianshu.com/p/22675c1632dc

1.创建Flutter 工程失败,空的文件

[undefined] flutter create --ios-language objc --android-language java .
Waiting for another flutter command to release the startup lock...
Cannot create a project within the Flutter SDK. Target directory '/Users/suning/Flutter_SDK/flutter/hello' is within the Flutter SDK at '/Users/suning/Flutter_SDK/flutter'.
exit code 1
Running "flutter packages get" in uuuu...  

⚠️:Cannot create a project within the Flutter SDK. Target directory ‘’ is within the Flutter SDK at '/flutter

PS:不要将工程项目目录建在flutter_SDK目录里面。注意不要在flutter_SDK目录及子目录下创建工程,可考虑在其它目录下创建工程。

2.flutter 导入新项目Target of URI doesn’t exist 'package:flutter/material.dart

path 中导入:

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

PS:然后注意使用外网:命令行里运行:flutter packages get

3.Flutter卡在Running “flutter packages get” in XXX的解决办法

PS:把你 flutter/bin/cache/lockfile 这个东西删了。重启 VS Studio
执行一下 flutter doctor命令

4.Waiting for another flutter command to release the startup lock…等待另一个flutter命令释放启动锁

1:退出 VS Code。
2:打开 flutter 安装目录 如:…\flutter\flutter\bin\cache 删除里面的 lockfile。
3:重启打开VS Code。

原因:当你的项目异常关闭,下次启动就会出现上面的一行话,
此时需要打开 flutter/bin/cache/lockfile,删除就行了
或者直接用下面的命令:rm ./flutter/bin/cache/lockfile

5.执行brew install --HEAD usbmuxd时,总是失败:Read me http://xxx

Xcode中引入flutter
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller

PS:彻底删除brew软件

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

在出现下图的情况时点击 y 键即可

PS:Mac 重装Homebrew
1·进入官网获取下载命令。官网:http://brew.sh/

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

重装后,继续执行 Xcode中引入flutter的 一系列操作。

6.Invalid constant value.

变量和 const 关键字冲突.将const 关键字去掉即可.

未完待续。。。

你可能感兴趣的:(Flutter开发教程)