获取错误:对于React Native:任务执行失败':app:transformClassesWithJarMergingForDebug'

时间:2018-02-16 06:50:39

标签: react-native libraries

我在添加新库时在react-native上出现此错误

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/exoplayer2/LoadControl.class

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

我知道它为什么通过在android文件夹

中运行以下命令返回错误
./gradlew app:dependencies

在不同的库下发现了多个版本的exoplayer。

我正在使用react-native-track-playerreact-native-audio-streamer

...
|    \--- com.google.android.exoplayer:exoplayer:r2.1.1
...


...
    |    +--- com.google.android.exoplayer:exoplayer-core:r2.4.3
...

当我移除react-native-audio-streamer并运行react-native run-android时,它正在运行 如何更改子库版本不是该库的所有者。

1 个答案:

答案 0 :(得分:0)

尝试

./gradlew clean

然后重新构建