Flutter 打包问题 Could not resolve io.flutter:arm64_v8a_release

问题日志

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

解决办法

你自己的磁盘:\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'
            }
}

解决成功日志

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

如有对你有帮助,支持一下,如有意见多多评论!

上一篇:linux 内核内置模块


下一篇:ARM64计算机上的Cassandra启动失败(java.lang.NoClassDefFoundError:无法初始化com.sun.jna.Native类)