Flutter gradle 构建失败并出现异常。> 找不到 com.otaliastudios:transcoder:0.9.1

Mus*_*afa 4 java gradle dart kotlin flutter

您好,当我尝试在 Android 模拟器上运行我的应用程序时,出现以下错误,

\n

我正在为我的项目使用 video_compress 3.1.2 依赖项,

\n

它适用于 ios 模拟器,但 gradle 给出了这个错误,我无法弄清楚

\n

我在 Maven 存储库上找到了这个链接,但我找不到如何使用它

\n

https://mvnrepository.com/artifact/com.otaliastudios/transcoder/0.9.1

\n
FAILURE: Build failed with an exception.\n\n* What went wrong:\nExecution failed for task \':app:mergeDebugAssets\'.\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* Try:\n> Run with --stacktrace option to get the stack trace.\n> Run with --info or --debug option to get more log output.\n> Run with --scan to get full insights.\n\n* Get more help at https://help.gradle.org\n\nBU\xc4\xb0LD FAILED in 20s\nException: Gradle task assembleDebug failed with exit code 1\nExited\n
Run Code Online (Sandbox Code Playgroud)\n

---Gradle kotlin----\n// https://mvnrepository.com/artifact/com.otaliastudios/transcoder \nimplementation("com.otaliastudios:transcoder:0.9.1")

\n

我将此依赖项放在 android -> 应用程序下的 build.gradle 文件中,但无法运行它。

\n

像这样 -

\n
\ndependencies {\n    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"\n    implementation platform(\'com.google.firebase:firebase-bom:31.0.2\')\n    implementation("com.otaliastudios:transcoder:0.9.1") //------------------------>new added\n}\n
Run Code Online (Sandbox Code Playgroud)\n

Jav*_*d98 17

我遇到了同样的错误,正如它指出的那样,问题似乎是该特定版本的转码器库在 Maven 或 google 存储库上不可用。

通过快速谷歌搜索,我发现了这个网页,它显示它在 jcenter 存储库上可用。因此,只需添加jcenter()到 android/build.gradle 文件,我就能解决这个问题。它应该看起来类似于这样:

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

希望能帮助到你!