Flutter的一些问题记录

一、安装的时间报:输入flutter doctor,时间走了一会儿报错:curl: (56) SSL read: error:00000000:lib(0):func(0):reason(0), errno 60:

解决办法:

先新建一个文件夹,然后依次输入下面的命令:

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

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

git clone -b dev https://github.com/flutter/flutter.git

export PATH="$PWD/flutter/bin:$PATH"

cd ./flutter

flutter doctor

就好了,我是没有输入前两句的export,具体的问题答案在:https://github.com/flutter/flutter/wiki/Using-Flutter-in-China

二、新建项目或者打开新的项目出现: Waiting for another flutter command to release the startup lock…

解决办法:

当你的项目异常关闭,或者android studio用任务管理器强制关闭,下次启动就会出现上面的一行话,

此时需要打开 flutter/bin/cache/lockfile,删除就行了

或者直接用下面的命令:rm ./flutter/bin/cache/lockfile

三、Got socket error trying to find package cupertino_icons at https://pub.dartlang.FLUTTER_STORAGE_BASE_URL

解决办法:

需要科学上网

其他为题正在收集中…(建议去flutter中的issues中查找有没有这个问题,没有的话请发送评论到本文尾部,也可以加我的微信:674668211)

四、采用android模拟器运行app,报出

java.lang.IllegalStateException: compileSdkVersion is not specified.

最后会有一行代码标记哪个地方出错:

Build file ‘/Users/vittorio/Desktop/kaifa/flutter/flutter_app/android/app/build.gradle’ line: 15

打开后我发现时引用了flutter sdk内部的文件:

apply from: “$flutterRoot/packages/flutter_tools/gradle/flutter.gradle”

也就是在你的flutter安装目录下面,不是你的项目下面,(/项目/flutter/packages/flutter_tools/gradle)

找到:

dependencies {

classpath ‘com.android.tools.build:gradle:3.0.1’

}

改成了我本地的编译版本原来的代码是:我把3.0.1改成了2.3.3,就好了