Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exoplayer Cast Extension is not compatible with Android 12 #9528

Closed
FunkyMuse opened this issue Oct 4, 2021 · 3 comments
Closed

Exoplayer Cast Extension is not compatible with Android 12 #9528

FunkyMuse opened this issue Oct 4, 2021 · 3 comments

Comments

@FunkyMuse
Copy link

Hello ExoPlayer team,

When trying to cast i'm getting this exception, this is reproducible on devices running on Android 12 only, it seems that a mutability flag is missing

java.lang.IllegalArgumentException: com.x.x: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
        at com.google.android.gms.internal.cast.zzch.zzb(com.google.android.gms:play-services-cast@@20.0.0:1)
        at com.google.android.gms.cast.framework.media.internal.zzp.zzb(com.google.android.gms:play-services-cast-framework@@20.0.0:10)
        at com.google.android.gms.cast.framework.CastSession.zzi(com.google.android.gms:play-services-cast-framework@@20.0.0:11)
        at com.google.android.gms.cast.framework.zzk.onComplete(com.google.android.gms:play-services-cast-framework@@20.0.0:1)
        at com.google.android.gms.tasks.zzj.run(com.google.android.gms:play-services-tasks@@17.2.0:4)

@andrewlewis andrewlewis added question and removed bug labels Oct 5, 2021
@ojw28 ojw28 changed the title Cast session Android 12 support Exoplayer Cast Extension is not compatible with Android 12 Oct 5, 2021
@ojw28
Copy link
Contributor

ojw28 commented Oct 5, 2021

This is not a bug in ExoPlayer, but is an issue that needs to be addressed by a new release of the Cast SDK (which ExoPlayer will then need to depend on). The underlying issue is tracked by https://issuetracker.google.com/195588434, and also [Internal ref: b/195476040]. There is a similar problem affecting the WorkManager extension (#9181).

Until the Cast SDK is updated to include a fix, I think you're stuck being unable to set your targetSdkVersion to target Android 12 (you can still use Android 12 features by setting compileSdkVersion to target Android 12, whilst holding targetSdkVersion to Android 11).

@FunkyMuse
Copy link
Author

This is not a bug in ExoPlayer, but is an issue that needs to be addressed by a new release of the Cast SDK (which ExoPlayer will then need to depend on). The underlying issue is tracked by https://issuetracker.google.com/195588434, and also [Internal ref: b/195476040]. There is a similar problem affecting the WorkManager extension (#9181).

Until the Cast SDK is updated to include a fix, I think you're stuck being unable to set your targetSdkVersion to target Android 12 (you can still use Android 12 features by setting compileSdkVersion to target Android 12, whilst holding targetSdkVersion to Android 11).

That's the current workaround yes, thank you for the detailed answer.

ojw28 added a commit that referenced this issue Dec 6, 2021
#minor-release
Issue: #9528
PiperOrigin-RevId: 413887784
@ojw28
Copy link
Contributor

ojw28 commented Dec 6, 2021

You can now workaround this issue just by including api 'com.google.android.gms:play-services-cast-framework:20.1.0' as an explicit dependency in your application. We have updated ExoPlayer's Cast extension to also use this newer version, and this change will be included in the next release.

@ojw28 ojw28 closed this as completed Dec 6, 2021
icbaker pushed a commit to androidx/media that referenced this issue Dec 7, 2021
#minor-release
Issue: google/ExoPlayer#9528
PiperOrigin-RevId: 413887784
@google google locked and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants