flutter打包出错问题处理

打包失败

flutter build apk --releaseInitializing gradle... 3.5sResolving dependencies... 215.7sGradle task 'assembleRelease'...FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:lintVitalRelease'.> Could not resolve all files for configuration ':app:lintClassPath'. > Could not download lint-checks.jar (com.android.tools.lint:lint-checks:26.2.1) > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-checks/26.2.1/lint-checks-26.2.1.jar'. > Read timed out > Could not download lint-api.jar (com.android.tools.lint:lint-api:26.2.1) > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-api/26.2.1/lint-api-26.2.1.jar'. > Read timed out > Could not download intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.2.1) > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/26.2.1/intellij-core-26.2.1.jar'. > Read timed out > Could not download uast.jar (com.android.tools.external.org-jetbrains:uast:26.2.1) > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.2.1/uast-26.2.1.jar'. > Read timed out > Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.12) > Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar'. > Could not GET 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar'. > Connect to d29vzk4ow07wi7.cloudfront.net:443 [d29vzk4ow07wi7.cloudfront.net/13.32.163.34, d29vzk4ow07wi7.cloudfront.net/13.32.163.93, d29vzk4ow07wi7.cloudfront.net/13.32.163.242, d29vzk4ow07wi7.cloudfront.net/13.32.163.206] failed: Read timed out > Could not download trove4j.jar (org.jetbrains.trove4j:trove4j:20160824) > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar'. > Could not GET 'https://jcenter.bintray.com/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar'. > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/75.126.118.188] failed: Read timed out > Could not download kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.2.1) > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.2.1/kotlin-compiler-26.2.1.jar'. > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.2.1/kotlin-compiler-26.2.1.jar'. > Remote host closed connection during handshake > Could not download error_prone_annotations.jar (com.google.errorprone:error_prone_annotations:2.0.18) > Could not get resource 'https://jcenter.bintray.com/com/google/errorprone/error_prone_annotations/2.0.18/error_prone_annotations-2.0.18.jar'. > Could not GET 'https://jcenter.bintray.com/com/google/errorprone/error_prone_annotations/2.0.18/error_prone_annotations-2.0.18.jar'. > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/75.126.118.188] failed: Read timed out* 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.orgBUILD FAILED in 4m 1s


修改项目下build.gradle和flutter/packages/flutter_tools/gradle/flutter.gradle两个文件中buildscript和allprojects,共三处

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

打包成功

Gradle task 'assembleRelease'... Done 21.9s
Built build/app/outputs/apk/release/app-release.apk (5.3MB).

你可能感兴趣的:(flutter打包出错问题处理)