如何从 Flutter 子模块中排除依赖项以与本机应用程序合并?

How do I exclude dependencies from Flutter submodule to merge with native app?

我有一个原生 android 项目,其中包含许多子模块和自定义 flutter 库,它们也作为子模块添加,并按照此处所述设置依赖项:option Bsettings.gradle

问题是一些子模块使用了 exoplayer,flutter 库也使用它。所以,在构建时我遇到了很多依赖问题:

Duplicate class com.google.android.exoplayer2.video.spherical.Projection$SubMesh found in modules jetified-exoplayer-core-2.10.1-runtime (com.amazon.android:exoplayer-core:2.10.1) and jetified-exoplayer-core-2.10.1-runtime (com.google.android.exoplayer:exoplayer-core:2.10.1)

在这种情况下似乎强制不起作用:

configurations.all {
    resolutionStrategy.force 'com.google.android.exoplayer:exoplayer-core:2.10.1'
}

如何从 flutter 库中排除 exoplayer?

我目前找到的唯一选择是构建 .arr 并从此处排除,但它对我不起作用,因为 flutter 库也在开发中。

替换

implementation project(':flutter')

implementation(project(":flutter")) {
        exclude module: 'exoplayer-core'
        exclude module: 'exoplayer-hls'
        exclude module: 'exoplayer-dash'
        exclude module: 'exoplayer-smoothstreaming'
    }

“项目”周围需要“(”和“)”