【错误记录】Flutter 报错 ( Could not resolve io.flutter:flutter_embedding_debug:1.0.0. )(一)

简介: 【错误记录】Flutter 报错 ( Could not resolve io.flutter:flutter_embedding_debug:1.0.0. )(一)

文章目录

一、 报错信息

二、 解决方案

三、 备选方案





一、 报错信息


从网上下载了一个 Flutter 工程代码 , 打开时 , 报如下错误 ;


Launching lib\main.dart on Pixel 2 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
     Required by:
         project :app
         project :app > project :image_picker
         project :app > project :url_launcher
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
         > Could not get resource 'https://jcenter.bintray.com/io/flutter/flutter_embedding_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'.
            > Could not HEAD 'https://jcenter.bintray.com/io/flutter/flutter_embedding_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'. Received status code 500 from server: Internal Server Error
   > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
     Required by:
         project :app
      > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
         > Could not get resource 'https://jcenter.bintray.com/io/flutter/arm64_v8a_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/arm64_v8a_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'.
            > Could not HEAD 'https://jcenter.bintray.com/io/flutter/arm64_v8a_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/arm64_v8a_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'. Received status code 500 from server: Internal Server Error
   > Could not resolve io.flutter:x86_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
         > Could not get resource 'https://jcenter.bintray.com/io/flutter/x86_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/x86_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'.
            > Could not HEAD 'https://jcenter.bintray.com/io/flutter/x86_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/x86_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'. Received status code 502 from server: Bad Gateway
   > Could not resolve io.flutter:x86_64_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_64_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
         > Could not get resource 'https://jcenter.bintray.com/io/flutter/x86_64_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/x86_64_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'.
            > Could not HEAD 'https://jcenter.bintray.com/io/flutter/x86_64_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/x86_64_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'. Received status code 502 from server: Bad Gateway
* 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 4s
Finished with error: Gradle task assembleDebug failed with exit code 1


image.png






二、 解决方案


在 Flutter 工程下的 android/build.gradle 下进行如下配置 :


在 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' }
maven { url "http://download.flutter.io" }


完整代码如下 :


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' }
        maven { url "http://download.flutter.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }
}
allprojects {
    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' }
        maven { url "http://download.flutter.io" }
    }
}
rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
    delete rootProject.buildDir
}




使用上述方案已解决问题 ;

image.png

目录
相关文章
|
5月前
|
Oracle NoSQL 关系型数据库
实时计算 Flink版操作报错之报错:java.lang.ClassNotFoundException: io.debezium.connector.common.RelationalBaseSourceConnector,如何解决
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
|
2月前
|
缓存 Dart 开发工具
解决Flutter报错The method ‘File.create‘ has fewer named arguments than those of overridden method
解决Flutter报错The method ‘File.create‘ has fewer named arguments than those of overridden method
54 3
|
2月前
Flutter更改主题颜色报错:type ‘Color‘ is not a subtype of type ‘MaterialColor‘
Flutter更改主题颜色报错:type ‘Color‘ is not a subtype of type ‘MaterialColor‘
36 4
|
2月前
|
开发工具 iOS开发
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
120 2
|
2月前
解决Flutter报错The named parameter |method ‘xxxx‘ isn‘t defined.
解决Flutter报错The named parameter |method ‘xxxx‘ isn‘t defined.
111 3
|
2月前
|
Dart
Flutter使用Scaffold报错。
Flutter使用Scaffold报错。
38 3
|
2月前
|
Java Android开发
解决Android编译报错:Unable to make field private final java.lang.String java.io.File.path accessible
解决Android编译报错:Unable to make field private final java.lang.String java.io.File.path accessible
312 1
|
2月前
|
iOS开发
解决Flutter运行IOS报错:Podfile is out of date
解决Flutter运行IOS报错:Podfile is out of date
56 1
|
2月前
解决Flutter报错boxconstraints has non-normalized height/width constraints
解决Flutter报错boxconstraints has non-normalized height/width constraints
36 0
|
2月前
|
Android开发
解决Android、Flutter编译时Gradle报错:javax.net.ssl.SSLException: Connection reset
解决Android、Flutter编译时Gradle报错:javax.net.ssl.SSLException: Connection reset
252 0