From c9109f437c506dd0eb5bdb19728d7d04d3ed202b Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Wed, 18 Dec 2019 10:24:10 +0000 Subject: [PATCH] Ensure raw resources are kept R8 does constant folding, so we need to keep buildRawResourceUri to ensure that resources passed to it are kept. PiperOrigin-RevId: 286153875 --- RELEASENOTES.md | 2 ++ library/core/proguard-rules.txt | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index cfaca5088d..fe8a639d1a 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -9,6 +9,8 @@ ([6773](https://github.com/google/ExoPlayer/issues/6773)). * Suppress ProGuard warnings for compile-time `javax.annotation` package ([#6771](https://github.com/google/ExoPlayer/issues/6771)). +* Fix proguard rules for R8 to ensure raw resources used with + `RawResourceDataSource` are kept. ### 2.11.0 (2019-12-11) ### diff --git a/library/core/proguard-rules.txt b/library/core/proguard-rules.txt index ab4af32da4..494837c3e9 100644 --- a/library/core/proguard-rules.txt +++ b/library/core/proguard-rules.txt @@ -1,5 +1,10 @@ # Proguard rules specific to the core module. +# Constant folding for resource integers may mean that a resource passed to this method appears to be unused. Keep the method to prevent this from happening. +-keep class com.google.android.exoplayer2.upstream.RawResourceDataSource { + public static android.net.Uri buildRawResourceUri(int); +} + # Constructors accessed via reflection in DefaultRenderersFactory -dontnote com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer -keepclassmembers class com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer { @@ -69,5 +74,5 @@ # Some members of this class are being accessed from native methods. Keep them unobfuscated. -keep class com.google.android.exoplayer2.ext.video.VideoDecoderOutputBuffer { - *; + *; }