Search code examples
androidreact-nativeexoplayerreact-native-video

Android dependency 'com.google.android.exoplayer:exoplayer' has different version for the compile (r2.1.0) and runtime (2.9.1) classpath


I used these two modules(react-native-video & react-native-nyt-360-video) in my app:

package.json:

...
"dependencies": {    
    "react": "16.8.3",
    "react-native": "0.59.5",
    "react-native-nyt-360-video": "1.0.2",
    "react-native-video": "^4.4.1"  
    ...
},

app/build.gradle:

...
dependencies {
    ...
    implementation project(':react-native-video')
    implementation project(':react-native-nyt-360-video')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
}

I need to have these two modules together becouse my app must play both common and 360 videos.

Now when i run project ( react-native run-android ) i encountered with this error:

...
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.google.android.exoplayer:exoplayer' has different version for the compile (r2.1.0) and runtime (2.9.1) classpath. 
You should manually set the same version via DependencyResolution

...

What i should do? please help me . Thankes


Solution

  • run > gradlew androidDependencies command. Using control + F you can look for the conflicting sub-dependencies and thus discover which direct dependency it belongs to.