[Crash][ExoPlayer] java.lang.NoSuchMethodError: No static method getDummyDrmSessionManager() when running app with library-dash module

Viewed 428

I am having crash when trying to play DASH stream using customized ExoPlayer library-dash module version 2.11.3, imported as an .aar archive. Here is the stacktrace:

Caused by: java.lang.NoSuchMethodError: No static method getDummyDrmSessionManager()Lcom/google/android/exoplayer2/drm/DrmSessionManager; in class Lcom/google/android/exoplayer2/drm/DrmSessionManager; or its super classes (declaration of 'com.google.android.exoplayer2.drm.DrmSessionManager' appears in base.apk)
        at com.google.android.exoplayer2.source.dash.DashMediaSource$Factory.<init>(DashMediaSource.java:118)
        at com.google.android.exoplayer2.source.dash.DashMediaSource$Factory.<init>(DashMediaSource.java:101)

Interesting thing is that crash occurs with signed app only. When I simply run it from studio, it works fine.

Here is the source code in ExoPlayer library-core module that I am having issue with

public interface DrmSessionManager<T extends ExoMediaCrypto> {

  /** Returns {@link #DUMMY}. */
  @SuppressWarnings("unchecked")
  static <T extends ExoMediaCrypto> DrmSessionManager<T> getDummyDrmSessionManager() {
    return (DrmSessionManager<T>) DUMMY;
  }

I do realize there is a Java 8 compatibility issue between my app and dash library being imported, and it probably needs some gradle fine tunning, but I cannot find what needs to be changed in my project to support this.

For project purposes, however, I had to modify the library-dash module, and to use it in my project as .aar. The build.gradle file inside Exo library-dash module from which I am building the .aar library, is unchanged and I made sure it contains these lines (these lines are also placed in library-core module of ExoPlayer project)

android {
    compileSdkVersion project.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

In my project, app module using this library contains these lines, and additionally this line

kotlinOptions {
    jvmTarget = "1.8"
}

The rest of the ExoPlayer library is used from remote repository:

api 'com.google.android.exoplayer:exoplayer-core:2.11.4'
api 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.11.4'
api 'com.google.android.exoplayer:exoplayer-hls:2.11.4'
api project(':lib-dash')

Root build.gradle file:

dependencies {
    classpath 'com.android.tools.build:gradle:4.0.0'

gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

What more needs to be added to support locally built .aar library-dash module and to avoid this kind of Java 8 incompatibilities?

0 Answers
Related