首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何解决任务执行失败的问题:app:checkDebugDuplicateClasses‘

如何解决任务执行失败的问题:app:checkDebugDuplicateClasses‘
EN

Stack Overflow用户
提问于 2021-08-17 07:49:22
回答 2查看 603关注 0票数 0

当我想运行这些应用程序时,我会得到错误。

任务的

执行失败:app:checkDebugDuplicateClasses‘。

我使用的软件包是:

^0.8.3+2

  • video_player:^2.1.13

  • video_editor:^1.2.0

代码语言:javascript
复制
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.google.android.exoplayer2.ui.package-info found in modules jetified-exoplayer-common-2.14.1-runtime.jar (com.google.android.exoplayer:exoplayer-common:2.14.1) and jetified-exoplayer-ui-2.13.2-runtime.jar (com.google.android.exoplayer:exoplayer-ui:2.13.2)

  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 53s

我怎么才能解决这个问题?

后加

dependency_overrides:

video_player: 2.1.13

代码语言:javascript
复制
e: D:\flutter\.pub-cache\hosted\pub.dartlang.org\wakelock-0.4.0\android\src\main\kotlin\creativemaybeno\wakelock\Wakelock.kt: (8, 16): Redeclaration: Wakelock
e: D:\flutter\.pub-cache\hosted\pub.dartlang.org\wakelock-0.4.0\android\src\main\kotlin\creativemaybeno\wakelock\Wakelock.kt: (41, 7): Redeclaration: NoActivityException        
e: D:\flutter\.pub-cache\hosted\pub.dartlang.org\wakelock-0.5.3+3\android\src\main\kotlin\creativemaybeno\wakelock\Wakelock.kt: (8, 16): Redeclaration: Wakelock
e: D:\flutter\.pub-cache\hosted\pub.dartlang.org\wakelock-0.5.3+3\android\src\main\kotlin\creativemaybeno\wakelock\Wakelock.kt: (41, 7): Redeclaration: NoActivityException      

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':wakelock:compileDebugKotlin'.
> Compilation error. See log for more details

* 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 24s
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-08-18 10:00:28

删除pubspec.lock并运行flutter pub get

基本上,由于video_editor使用video_player的v2.1.12作为依赖项而导致版本不匹配,而后者又使用了系外播放器。

这是一个简单的方法。

另一种选择是使用依赖覆盖,但这不安全

代码语言:javascript
复制
dependency_overrides:
  video_player: 2.1.13

依赖项重写https://dart.dev/tools/pub/dependencies#dependency-overrides的参考文档

票数 1
EN

Stack Overflow用户

发布于 2021-11-16 10:52:02

这对我有用。

代码语言:javascript
复制
1. flutter clean

2. flutter run
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68813529

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档