【错误记录】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

目录
相关文章
flutter开发中Use ‘const’ with the constructor to improve performance. Try adding the ‘const’ keyword to the constructor invocation.报错如何解决-优雅草卓伊凡
flutter开发中Use ‘const’ with the constructor to improve performance. Try adding the ‘const’ keyword to the constructor invocation.报错如何解决-优雅草卓伊凡
249 1
|
缓存 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
248 3
|
SQL Java 数据库连接
【YashanDB知识库】个别数据库用户无法登录数据库,报错 io fail:IO.EOF
【YashanDB知识库】个别数据库用户无法登录数据库,报错 io fail:IO.EOF
|
运维 Cloud Native Java
postman发起post请求遇到报错:java.io.FileNotFoundException (文件名、目录名或卷标语法不正确。)
遇到bug报错,多猜可能的原因,控制变量反复测试,直至找到问题的关键,然后再思考如何解决或者回避。 博客不应该只有代码和解决方案,重点应该在于给出解决方案的同时分享思维模式,只有思维才能可持续地解决问题,只有思维才是真正值得学习和分享的核心要素。如果这篇博客能给您带来一点帮助,麻烦您点个赞支持一下,还可以收藏起来
|
关系型数据库 MySQL Linux
升级到MySQL 8.4,MySQL启动报错:io_setup() failed with EAGAIN
当MySQL 8.4启动时报错“io_setup() failed with EAGAIN”时,通常是由于系统AIO资源不足所致。通过增加AIO上下文数量、调整MySQL配置、优化系统资源或升级内核版本,可以有效解决这一问题。上述解决方案详细且实用,能够帮助管理员快速定位并处理此类问题,确保数据库系统的正常运行。
529 9
|
存储 测试技术 Shell
Flutter UT太多导致跑覆盖率报错
Flutter UT太多导致跑覆盖率报错
193 2
Flutter更改主题颜色报错:type ‘Color‘ is not a subtype of type ‘MaterialColor‘
Flutter更改主题颜色报错:type ‘Color‘ is not a subtype of type ‘MaterialColor‘
222 4
解决Flutter报错The named parameter |method ‘xxxx‘ isn‘t defined.
解决Flutter报错The named parameter |method ‘xxxx‘ isn‘t defined.
887 3
|
Dart
Flutter使用Scaffold报错。
Flutter使用Scaffold报错。
224 3