1

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?

surbhi verma
  • 357
  • 4
  • 11
  • Possible duplicate of [Error inflating class com.google.android.exoplayer2.ui.SimpleExoPlayerView](https://stackoverflow.com/questions/49533046/error-inflating-class-com-google-android-exoplayer2-ui-simpleexoplayerview) – isaaaaame Oct 01 '19 at 13:08
  • No, my code contains properties shown in this link (https://stackoverflow.com/questions/49533046/error-inflating-class-com-google-android-exoplayer2-ui-simpleexoplayerview) but still facing the issue. – surbhi verma Oct 01 '19 at 13:20
  • Found solution for this, it was not any development error but as the app's apk was uploaded as a bundle, then the user was installing the app after sharing the bundle apk (sideloading). So because of that, this error was thrown. – surbhi verma Oct 14 '19 at 05:38

2 Answers2

2

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.
}
surbhi verma
  • 357
  • 4
  • 11
2

As per the Documentation, please add below lines in build.gradle(Module:app)

compileOptions {
    targetCompatibility JavaVersion.VERSION_1_8
}

Hope this helps.

Tschallacka
  • 27,901
  • 14
  • 88
  • 133
Naveen rana
  • 101
  • 6