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

After the system was reinstalled some time ago, the Flutter Packages get execution has been stuck here, and the problem was reported when executed again. Waiting for another flutter command to release the startup lock. Checked the information and found the following method:

1: close as

2: CTRL+ALT+DEL close all dart processes and android processes, pay attention to adb, don’t forget to close

3: Open the flutter installation directory, such as:...\flutter\bin\cache

    Delete the lockfile inside

4: Open as, first click Invalidate below and then open this window and click Just Restart.

After performing the above operations, I got a response and reported the following questions:

OS Error: The semaphore timeout period has expired

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

 Although you have encountered new problems, is it still a kind of progress? I am not afraid that it will respond, I am afraid that it will not respond! Continue to inquire about related issues~

Google search, it turns out that flutter has a countermeasure.

Using Flutter in China 。

It probably means that you can change the default package acquisition address to a mirror site that has no problem.

Specific operation

  • Linux or Mac

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

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

  • Windows

Just add two environment variables

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

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

Execute the flutter doctor command

There should be no problem downloading in package get.

 

Flutter mixed development operation error: VM snapshot must be valid. /Check failed: vm. Must be able to initialize the VM.

When integrating flutter_boost in an existing android project, a crash occurs when running host app:

 

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

Finding the information, you need to change packages/flutter_tools/gradle/flutter.gradle in the flutter_sdk directory:
this sentence
variant.outputs[0].processResources.dependsOn(copyFlutterAssetsTask) is
changed to
variant.outputs[0].processResources.dependsOn(flutterTask) )

In addition, you need to add in the android{} node of the fluttermodule build file Flutter/build.gradle:

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)
    }
}

Comparing the project, under the fluttermodule/.android/Flutter/Build/intermediates/flutter folder, if debug/flutter_assets is missing, this folder will also be missing under the main project Flutter, causing the project to crash.

Comparing the apk, it is found that the lack of flutter_shared or flutter_assets in the assets folder will cause the above crash.

 

 

Flutter packaging problem Could not resolve io.flutter:arm64_v8a_release resolved

Problem log

Running Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:processReleaseResources'.
> Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
   > Could not resolve io.flutter:arm64_v8a_release:1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.
     Required by:
         project :app
      > Could not resolve io.flutter:arm64_v8a_release:1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.
         > Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/arm64_v8a_release-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.pom'.
            > Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/arm64_v8a_release-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.pom'.
               > Connect to storage.googleapis.com:443 [storage.googleapis.com/34.64.4.16] failed: Connection timed out: connect
      > Could not resolve io.flutter:arm64_v8a_release:1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.
         > Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/arm64_v8a_release-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.pom'.
            > Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/arm64_v8a_release-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.pom'.
               > Connect to storage.googleapis.com:443 [storage.googleapis.com/34.64.4.80] failed: Connection timed out: connect
      > Could not resolve io.flutter:arm64_v8a_release:1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.
         > Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/arm64_v8a_release-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.pom'.
            > Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_release/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/arm64_v8a_release-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.pom'.
               > Connect to storage.googleapis.com:443 [storage.googleapis.com/34.64.4.80] failed: Connection timed out: connect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
BUILD FAILED in 8m 15s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                     496.8s (!)
Gradle task assembleRelease failed with exit code 1

Solution

1. Your own disk: \flutter\packages\flutter_tools\gradle\flutter.gradle

buildscript {
    repositories {
    		//注释以前的
    	 //google()
	   // jcenter()
	     ///增加这段代码
        maven { url'https://maven.aliyun.com/repository/google'}
		maven { url'https://maven.aliyun.com/repository/jcenter'}
		maven { url'http://maven.aliyun.com/nexus/content/groups/public'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
    }
}
class FlutterPlugin implements Plugin<Project> {
	//原下载路径
 	//private static final String MAVEN_REPO      = "https://storage.googleapis.com/download.flutter.io";
 	//修改后的下载路径
    private static final String MAVEN_REPO      = "https://storage.flutter-io.cn/download.flutter.io"

project.rootProject.allprojects {
            repositories {
                maven {
                    url repository
                }
                ///增加这段代码
				maven { url'https://maven.aliyun.com/repository/google'}
				maven { url'https://maven.aliyun.com/repository/jcenter'}
				maven { url'http://maven.aliyun.com/nexus/content/groups/public'
            }
}

2. Project location: project name/android/build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
       /*   google()
          jcenter()*/
        maven{ url 'https://maven.aliyun.com/repository/google' }
        maven{ url 'https://maven.aliyun.com/repository/jcenter' }
        maven{ url 'https://maven.aliyun.com/repository/public'}
        maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
      /*   google()
         jcenter()*/
        maven{ url 'https://maven.aliyun.com/repository/google' }
        maven{ url 'https://maven.aliyun.com/repository/jcenter' }
        maven{ url 'https://maven.aliyun.com/repository/public'}
        maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Solve success log

	G:\workspaces\intelligent-logistics-app>flutter  build apk
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...
Removed unused resources: Binary resource data reduced from 894KB to 884KB: Removed 1%
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                     216.2s (!)
√ Built build\app\outputs\apk\release\app-release.apk (27.0MB).

 

 

Guess you like

Origin blog.csdn.net/MYBOYER/article/details/92101101
Recommended