When I upgrade exoplayer to version 2.16.0, it crashes when I run the line below the code:
exoPlayer = ExoPlayer.Builder(this).build()
I tested on higher Androids version like 10 and 11 (android api 29 and 30) and there is no problem, but in Android version 5 and 6 it crashes (android api 21 and 23) Previously, in version 2.11.8, which I used, it ran without any problems in all versions of Android, but since I updated it to version 2.16.0, I have seen this problem in Android version 5 and 6.
What should I do to solve this problem?
My error log:
java.lang.NoClassDefFoundError: com.google.android.exoplayer2.ExoPlayer$Builder$$ExternalSyntheticLambda0
at com.google.android.exoplayer2.ExoPlayer$Builder.<init>(ExoPlayer.java:440)
at com.myapp.Activity.VideoActivity_Online.onCreate(VideoActivity_Online.kt:58)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I use com.squareup.moshi:moshi-kotlin-codegen:1.12.0 in my project and face same issue with Exoplayer. Probably moshi codegen breaks desugaring mechanics (Exoplayer code contains java 8 lambdas). If you use moshi too, try downgrade or upgrade moshi version. Also check other code generation tools used by your project.
Upd:
I found that in one of project modules i use implementation com.squareup.moshi:moshi-kotlin-codegen:1.12.0 instead kapt com.squareup.moshi:moshi-kotlin-codegen:1.12.0. After replacing from implementation to kapt all works as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With