I trying to use different version of google exoplayer in one project. In main module i had to use older version exo(2.11), which loaded from maven repo, this repo has not required hls part of exo. But i need it, so then i've created another module in android studio, and implement latest version of Exoplayer(2.18) in new gradle file.
In main app build.gradle i used
repositories {
maven { url 'https://maven with old exoplayer' }
dependencies {
api (project(':SecondModule')){
//transitive = false
exclude group:'com.google.android.exoplayer', module: 'exoplayer'
}
In second module build.gradle
dependencies {
//Exoplayer
implementation 'com.google.android.exoplayer:exoplayer:2.18.1'
}
This construction avoid duplicate class on Gradle building, but it throws Exception when i try to Exoplayer.Builder in second module(2.18 exoplayer ver).
java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;)V in class Lcom/google/android/exoplayer2/ExoPlayer$Builder; or its super classes (declaration of 'com.google.android.exoplayer2.ExoPlayer$Builder' appears in /data/app/~~mJCED0bXkJY3ZMLmUlzyHg==/org.eltex.android.app.myapplication-mWxK6M8UoNXGWEFPF8SbgA==/base.apk)
Is there a way to use application with two different version Exoplayer in defferent modules? Thank you.