Flutter问题解决之 Waiting for another flutter command to release the startup lock.

前段时间系统重装了一次之后,执行Flutter的Packages get一直卡在这里,再执行一次报这个问题Waiting for another flutter command to release the startup lock.查看了一下资料,找到了以下方法:

1:关闭 as

2:CTRL+ALT+DEL 关闭所有 dart进程和android进程,注意adb这个别忘了关

3:打开 flutter 安装目录  如:...\flutter\bin\cache

    删除里面的 lockfile

4:打开 as 先点击下面的 Invalidate 再打开此窗口 点击 Just Restart。

Flutter问题解决之 Waiting for another flutter command to release the startup lock._第1张图片

执行以上操作,然后有反应了,报了以下问题:

OS Error: 信号灯超时时间已到

, errno = 121, address = pub.dartlang.org, port = 53249

 虽然遇到了新问题,但也算一种进展吗?不怕它有反应,就怕它没反应啊!继续查询相关问题~

Google搜索一下,原来flutter 已经有对策了。

Using Flutter in China 。

大概意思就是 把默认的 package 获取地址改为访问没有问题的镜像站就可以了。

具体操作

  • Linux 或 Mac

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

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

  • Windows

新增两个环境变量即可

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

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

执行一下 flutter doctor命令

下载在 package get 应该就没有问题了。

 

flutter混合开发运行报错:VM snapshot must be valid. /Check failed: vm. Must be able to initialize the VM.

在现有android项目中集成flutter_boost时,运行host app发生崩溃:

 

VM snapshot must be valid. 
Check failed: vm. Must be able to initialize the VM.

查找资料得知,需要将flutter_sdk目录下packages/flutter_tools/gradle/flutter.gradle:
这句话
variant.outputs[0].processResources.dependsOn(copyFlutterAssetsTask)
改为
variant.outputs[0].processResources.dependsOn(flutterTask)

另外需要在fluttermodule的build文件Flutter/build.gradle的android{}节点添加:

project.android.libraryVariants.all { variant ->
    def targetAssets = "${project.buildDir}/intermediates/flutter/${variant.name}"
    def customSourceSet = variant.getSourceSets()[0]
    if (customSourceSet instanceof com.android.build.gradle.internal.api.DefaultAndroidSourceSet) {
        customSourceSet = (com.android.build.gradle.internal.api.DefaultAndroidSourceSet)customSourceSet
        customSourceSet.getAssets().srcDirs(targetAssets)
    }
}

对比项目,fluttermodule/.android/Flutter/Build/intermediates/flutter文件夹下,如果缺少debug/flutter_assets会导致主项目Flutter下也缺少这个文件夹,导致项目崩溃。

对比apk发现,assets文件夹下缺少flutter_shared或者flutter_assets会导致以上崩溃。

 

 

你可能感兴趣的:(Flutter开发实践)