Failed resolution of: LogSessionId
Version
Media3 pre-release (alpha, beta or RC not in this list)
More version details
Devices that reproduce the issue
Samsung S9 - Android 9 Xiaomi Redmi Note 8 Pro - Android 10
Devices that do not reproduce the issue
Galaxy S23 Ultra Android 14
Reproducible in the demo app?
Not tested
Reproduction steps
Start a media3 transformer to render a video on a release build with minify enabled using the current alpha version of the library
I've already added
-keep class android.media.metrics.LogSessionId
To my proguard-rules.pro
It seems like LogSessionId requires api level 31 anyway so it's no wonder older devices can't find the class definition
Expected result
Transformer renders the video
Actual result
Crash:
# Crashlytics - Stack trace
# Application: com.cardinalblue.onbeat
# Platform: android
# Version: 1.71-develop (71)
# Issue: d52f187bfdb55de3fbb88612fbc6d99b
# Session: 684FB543031200012084CCCBFF43DF31_DNE_0_v2
# Date: Mon Jun 16 2025 14:18:45 GMT+0800 (Taipei Standard Time)
Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/media/metrics/LogSessionId;
at androidx.media3.transformer.DefaultAssetLoaderFactory.createAssetLoader(DefaultAssetLoaderFactory.java:204)
at androidx.media3.transformer.SequenceAssetLoader$GapInterceptingAssetLoaderFactory.createAssetLoader(SequenceAssetLoader.java:840)
at androidx.media3.transformer.SequenceAssetLoader.<init>(SequenceAssetLoader.java:158)
at androidx.media3.transformer.TransformerInternal.<init>(TransformerInternal.java:252)
at androidx.media3.transformer.Transformer.startInternal(Transformer.java:1712)
at androidx.media3.transformer.Transformer.start(Transformer.java:1034)
at com.cardinalblue.onbeat.timeline.VideoTrimRendererKt$run$2.invokeSuspend(VideoTrimRenderer.kt:146)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6981)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
Caused by java.lang.ClassNotFoundException: Didn't find class "android.media.metrics.LogSessionId" on path: DexPathList[[zip file "/data/app/com.cardinalblue.onbeat-IXp6YYqXJu8f7cu6O_JW9w==/base.apk"],nativeLibraryDirectories=[/data/app/com.cardinalblue.onbeat-IXp6YYqXJu8f7cu6O_JW9w==/lib/arm64, /data/app/com.cardinalblue.onbeat-IXp6YYqXJu8f7cu6O_JW9w==/base.apk!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.media3.transformer.DefaultAssetLoaderFactory.createAssetLoader(DefaultAssetLoaderFactory.java:204)
at androidx.media3.transformer.SequenceAssetLoader$GapInterceptingAssetLoaderFactory.createAssetLoader(SequenceAssetLoader.java:840)
at androidx.media3.transformer.SequenceAssetLoader.<init>(SequenceAssetLoader.java:158)
at androidx.media3.transformer.TransformerInternal.<init>(TransformerInternal.java:252)
at androidx.media3.transformer.Transformer.startInternal(Transformer.java:1712)
at androidx.media3.transformer.Transformer.start(Transformer.java:1034)
at com.cardinalblue.onbeat.timeline.VideoTrimRendererKt$run$2.invokeSuspend(VideoTrimRenderer.kt:146)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6981)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
Media
Media doesn't matter
Bug Report
- [ ] You will email the zip file produced by
adb bugreportto [email protected] after filing this issue.
Adding the following lines to my proguard.pro fixed it
# Keep LogSessionId class and related classes
-keep class android.media.metrics.LogSessionId { *; }
-keep class android.media.metrics.** { *; }
# Keep Media3 classes that use reflection
-keep class androidx.media3.** { *; }
-dontwarn android.media.metrics.**
# Alternative: If you want to be more specific
-keepclassmembers class androidx.media3.transformer.DefaultAssetLoaderFactory {
*;
}
Framework classes don't get obfuscated or have symbols removed, so I'm not sure why things under android.media would need to be kept -- it shouldn't make a difference.
Reopening to investigate what's going on and change how LogSessionId is referred to if necessary.
Media3 1.8.0 released as "stable" to general public... apps crashing in production suddenly after updating the dependency version:
Caused by java.lang.ClassNotFoundException: android.media.metrics.LogSessionId at androidx.media3.transformer.DefaultAssetLoaderFactory.createAssetLoader(DefaultAssetLoaderFactory.java:199) at androidx.media3.transformer.SequenceAssetLoader$GapInterceptingAssetLoaderFactory.createAssetLoader(SequenceAssetLoader.java:840) at androidx.media3.transformer.SequenceAssetLoader.<init>(SequenceAssetLoader.java:158) at androidx.media3.transformer.TransformerInternal.<init>(TransformerInternal.java:252) at androidx.media3.transformer.Transformer.startInternal(Transformer.java:1712) at androidx.media3.transformer.Transformer.start(Transformer.java:1034) at androidx.media3.transformer.Transformer.start(Transformer.java:1076) at com.REDACTED_PACKAGE_NAME.lambda$processTakenVideo$56(REDACTED_Activity.java:2644) at android.os.Handler.handleCallback(Handler.java:900) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8668) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
``
@EzequielAdrianM Please can you give some more information about how you built the APK that produced the quoted stack trace, and what device/OS version the stack trace is from?
In particular for the build:
- Did the build include D8 and/or R8, and if so what versions of these were used?
- If the build used Gradle, what versions of Gradle and AGP were used?
It might also help if you can share an APK that reproduces the issue by emailing it to [email protected] with subject Issue #2535 (and updating this issue when you've done so).
It would also be interesting if you can still reproduce the issue with horizontal class merging disabled in R8. I think you can do this by putting the following line in your gradle.properties file:
systemProp.com.android.tools.r8.disableHorizontalClassMerging=true
If this does resolve the issue, please can you remove the line again and share the ZIP files produced by this build command (i.e. when producing the broken APK) - you can email them as described above:
$ ./gradlew assembleRelease \
--no-daemon \
-Dcom.android.tools.r8.dumpinputtodirectory=/path/to/dumps
The issue does not happen on every device. That particular stack trace was from a Xiaomi Mi 10 pro (Android 10) but same issue appeared on Samsung galaxy J7, J8 (Android 10), A20 (Android 9), A10s (Android 11), J2 core, Huawei P30 Lite (Android 10), Redmi 9C NFC (Android 11), and some Moto E6 Android 9 and Oppo devices.
We used AGP 8.7.3 and Gradle version 8.9 (Android Studio Ladybug).
The issue was solved by adding the following lines to proguard-rules.pro
# Keep LogSessionId class and related classes
-keep class android.media.metrics.LogSessionId { *; }
-keep class android.media.metrics.** { *; }
# Keep Media3 classes that use reflection
-keep class androidx.media3.** { *; }
-dontwarn android.media.metrics.**
The issue was solved by adding the following lines to proguard-rules.pro
# Keep LogSessionId class and related classes -keep class android.media.metrics.LogSessionId { *; } -keep class android.media.metrics.** { *; } # Keep Media3 classes that use reflection -keep class androidx.media3.** { *; } -dontwarn android.media.metrics.**
As @andrewlewis said above, this ideally shouldn't be needed. We believe there might be a bug in R8 that is causing this issue, but we haven't yet been able to reproduce it so aren't really able to investigate it further.
If you are able to provide the R8 dumps I suggested above, that would be very helpful for us to pass to the R8 team to take a look at.
Hey @AradiPatrik. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@AradiPatrik if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
This issue is still valid, please reopen this. It's affecting all of our users on Android < 10.
UPD: Filed https://issuetracker.google.com/issues/446479791
@Nek-12 Can you share the information requested earlier in this thread, to help diagnose the problem?
Sure, but do you want it here, or on googleissuetracker? I'll post to issue tracker for now.
I'd prefer to keep the discussion in one place (here).
Regarding your reply in issuetracker.google.com/issues/446479791#comment2, please can you check if the issue goes away with systemProp.com.android.tools.r8.disableHorizontalClassMerging=true? I appreciate you would prefer to avoid this if possible, but it helps track down the problem (and seems like a reasonable workaround). If it does work, can you also share the diagnostic info requested earlier in this thread with that option turned off?
Give me a few days or up to 2 weeks to respond. I have higher priority tickets at work right now. Do NOT summon the dreaded bot please.
@Nek-12 Any updates? Thanks.
Hi, thanks for asking. I remember about this issue - we filed a ticket. It's still on my backlog - we postponed it since we have a workaround. I can't promise availability, but will keep you posted. I may spend time on this at the end of the week.
Hi @andrewlewis , I had the same issue. The proguard configuration mentioned above fixes it. However I was not able to reproduce on my devices, I only saw crash reports. I think you can just build any APK using the library and the issue will be there.