My exoplayer2 is working fine in devices like Samsung, Motorola, Xiomi, sony etc on both release and debug build.
But when I have released my app on play store, it is throwing error on devices like nexus 4(Android version 6.0.1) and some Vivo models like Vivo Y53, Y71, and V5 having android version 6.0.1, 7 and 8.
Crashlytics showing this error : Caused by android.view.InflateException: Binary XML file line #153: Error inflating class com.google.android.exoplayer2.ui.PlayerView
My code already contains properties mentioned in Error inflating class com.google.android.exoplayer2.ui.SimpleExoPlayerView but still facing issue in few devices.
Can it be because of custom ROM in Vivo and Nexus devices?
Found solution for this, it was not any development error because if it would have been any code error, then it should have occurred on multiple devices.
So, my last resort was to rectify what exactly is happening. As the app's apk was uploaded as a bundle, then if the user was installing the app after sharing the bundle apk (sideloading) by ShareIt or Whatsapp, it was getting crash, because it is app bundle's property that we cannot share the APK generated from bundle.
So, to check that if user is installing the app through sideloading, we can add google's play core library to let them know that the "app is missing components. Please install from playstore".
Gradle:
implementation 'com.google.android.play:core:1.6.3'
Application Class in onCreate():
if (MissingSplitsManagerFactory.create(this)
.disableAppIfMissingRequiredSplits()) {
return;
// Skip app initialization.
}