简体   繁体   English

为什么在 Flutter 运行后出现此错误?

[英]Why I am getting this error after Flutter Run?

I am getting the following Build failed with exception after I run my flutter project.在我运行 flutter 项目后,我收到以下 Build failed 异常。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.google.android.exoplayer2.ui.DownloadNotificationHelper found in modules jetified-exoplayer-core-2.17.0-runtime (com.google.android.exoplayer:exoplayer-core:2.17.0) and jetified-exoplayer-ui-2.15.1-runtime (com.google.android.exoplayer:exoplayer-ui:2.15.1)

     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

* 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 3m 26s
Running Gradle task 'assembleDebug'...                            208.9s
Exception: Gradle task assembleDebug failed with exit code 1

I am currently using Flutter's latest version that is Version 2.10.1.我目前正在使用 Flutter 的最新版本,即 2.10.1 版。 Also in my project, I used the 'better_player' pub package.同样在我的项目中,我使用了“better_player”酒吧 package。

Please give me a solution to this.请给我一个解决方案。

Add following dependency in app/build.gradle in dependencies at the end of the file -在文件末尾的依赖项中的 app/build.gradle 中添加以下依赖项 -

implementation 'com.google.android.exoplayer:exoplayer:2.17.0'实施 'com.google.android.exoplayer:exoplayer:2.17.0'

Example -例子 -

dependencies {

    ...

    implementation 'com.google.android.exoplayer:exoplayer:2.17.0'

}

First: if you are using video_player add this line in your app/build.gradle第一:如果你使用 video_player 在你的 app/build.gradle 添加这一行

implementation 'com.google.android.exoplayer:exoplayer:2.17.1'

Second: if you are using better_player add this line in your app/build.gradle第二:如果你使用 better_player 在你的 app/build.gradle 添加这一行

implementation 'com.google.android.exoplayer:exoplayer:2.15.0'

Third: if you are using the both video_player & better_player you should downgraded video_player version to 2.1.12 in pubspec.yaml第三:如果您同时使用video_playerbetter_player ,则应在 pubspec.yaml 中将video_player版本降级为 2.1.12

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我在运行后在 Flutter 上收到“无法执行 aapt”错误? - Why am I getting "Failed to execute aapt" error on Flutter after run? 为什么我在 flutter android 项目中收到 gradle 错误? - Why I am getting gradle error in flutter android project? 为什么在运行应用程序时出现此错误? - Why am I getting this error when I run my app? 使用意图后为什么会出现此错误? - Why am I getting this error after I use intent? 我无法统一获得currentActivity,并且在设备中运行应用程序后出现以下错误 - I am not able to get the currentActivity in unity,and i am getting the following error after the application is run in the device 为什么我每次在手机上运行新的 flutter 代码时都会得到默认的 flutter 示例代码? - Why am i getting the default flutter example code every time i run my new flutter code on my phone? Flutter:为什么我会收到“垂直视口的高度无界”错误? - Flutter: Why I am getting "Vertical viewport was given unbounded height" error? Flutter:为什么我收到错误“路由构建器必须永远不会返回null”? - Flutter: Why am I getting the error “Route builders must never return null”? 我当时在 Qt 中运行项目我收到此错误 - I am run the project in Qt at that time i am getting this error 为什么运行此应用程序时出现“找不到文件”错误? - Why am I getting file not found error when I run this app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM