ExoPlayer: Android 12L - AbstractMethodError calling onSpatializerAvailableChanged

ExoPlayer Version

2.18.0

Devices that reproduce the issue

All devices that have this issue are Samsung devices within the Galaxy Z Fold/Flip series, running Android 12 (presumably 12L)

For example, the three most popular devices experiencing this issue are:

  • Galaxy Z Flip3 5G
  • Galaxy Z Flip4
  • Galaxy Z Fold3 5G

Devices that do not reproduce the issue

Non-Galaxy Z Flip/Fold series devices

Reproducible in the demo app?

Not tested

Reproduction steps

We have seen this issue in the wild and unfortunately do not have access to the affected devices to find steps to reproduce this crash.

Based on the crash reports received, it seems 86% of crashes occur when the app is in the background. Due to the nature of foldable devices, this could be perhaps linked to a form config change (i.e. folding/unfolding) or something similar.

Should it help, our player is defined as follows (with some minor code omitted)

// Cache
val cache = SimpleCache(createVideoCacheDir(context),
                LeastRecentlyUsedCacheEvictor(VIDEO_CACHE_SIZE.toLong()),
                ExoDatabaseProvider(context))

// CacheDataSource
val upstreamFactory: DataSource.Factory = OkHttpDataSourceFactory({ request -> okHttp.newCall(request) }, USER_AGENT)
val cacheDataSource = CacheDataSource.Factory()
                .setCache(exoCache)
                .setUpstreamDataSourceFactory(upstreamFactory)
                .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)

// ExoPlayer
ExoPlayer.Builder(context)
                .setLooper(Looper.getMainLooper())
                .setMediaSourceFactory(DefaultMediaSourceFactory(cacheDataSource))
                .setTrackSelector(DefaultTrackSelector(context, AdaptiveTrackSelection.Factory()))
                .build()

Expected result

The media plays successfully and backgrounding the app works as expected

Actual result

Exoplayer crashes with the following stacktrace

Fatal Exception: java.lang.AbstractMethodError: abstract method "void android.media.Spatializer$OnSpatializerStateChangedListener.onSpatializerAvailableChanged(android.media.Spatializer, boolean)"
       at android.media.Spatializer$SpatializerInfoDispatcherStub.lambda$dispatchSpatializerAvailableChanged$1$Spatializer$SpatializerInfoDispatcherStub(Spatializer.java:529)
       at android.media.Spatializer$SpatializerInfoDispatcherStub$$ExternalSyntheticLambda0.run(Spatializer.java:6)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.os.HandlerThread.run(HandlerThread.java:67)

Media

Not applicable

Bug Report

  • You will email the zip file produced by adb bugreport to dev.exoplayer@gmail.com after filing this issue.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 24 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Well, we weren’t fully aware of this either until yesterday. 😃

But it definitely seems expected that an app uses at least the compile SDK that all of its dependencies are using. Some dependencies like AndroidX appcompat seem to be able to enforce this automatically, so we’ll try to do the same in the future to avoid the additional documentation need.