Flutter构建应用程序失败执行任务“:app:checkDebugAarMetadata”失败

gzszwxb4  于 2022-11-25  发布在  Flutter
关注(0)|答案(1)|浏览(408)

我在尝试在Android Studio上构建flutter应用时收到以下错误

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.otaliastudios:transcoder:0.9.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom
       - https://repo.maven.apache.org/maven2/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom
       - https://storage.googleapis.com/download.flutter.io/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom
     Required by:
         project :app > project :video_compress

我尝试了flutter cleanflutter pub cache repair,也删除了pubspec.lock..仍然没有解决问题
下面是flutter doctor的结果

[√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.22621.819], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.73.1)
[√] VS Code, 64-bit edition (version 1.64.1)
[√] Connected device (4 available)
[√] HTTP Host Availability
vjhs03f7

vjhs03f71#

我能够通过在项目级build.gradle中添加这一行来找到解决方案,这要归功于这个answer

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://plugins.gradle.org/m2/" } //Added this line
    }
}

另一个解决方案也对我有效,但是使用了jcenter(),显然已经到了服务结束的时候

allprojects {
    repositories {
        google()
        jcenter() //instead of mavenCentral()
    }
}

显然这是Gradle服务器的问题,但不确定这是否是最好的解决方案,但它为我工作。

相关问题