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

Amm*_*med 1 android flutter

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

\n
FAILURE: Build failed with an exception.\n\n* What went wrong:\nExecution failed for task ':app:checkDebugAarMetadata'.\n> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.\n   > Could not find com.otaliastudios:transcoder:0.9.1.\n     Searched in the following locations:\n       - https://dl.google.com/dl/android/maven2/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom\n       - https://repo.maven.apache.org/maven2/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom\n       - https://storage.googleapis.com/download.flutter.io/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom\n     Required by:\n         project :app > project :video_compress\n\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试flutter clean flutter pub cache repair并删除了 pubspec.lock ..问题仍然没有解决

\n

这是结果flutter doctor

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

Amm*_*med 8

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

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

另一个对我有用但使用 jcenter() 的解决方案显然已达到服务终止

allprojects {
    repositories {
        google()
        jcenter() //instead of mavenCentral()
    }
}
Run Code Online (Sandbox Code Playgroud)

显然这是 gradle 服务器问题,但不确定这是否是最好的解决方案,但它对我有用。