如何解决如何防止错误膨胀类 com.google.android.exoplayer2.ui.PlayerView?
Exoplayer2 在三星、Vivo、小米等设备上的发布和调试版本都运行良好。但是当我在 Play 商店上发布我的应用程序时,它会在某些设备(如 nexus、像素手机)上抛出错误。
Crashlytics showing this error: Caused by android.view.InflateException:
Binary XML file line #11: Error inflating class com.google.android.exoplayer2.ui.PlayerView
我发现已经针对同一问题提出了一些类似的问题,但对我没有用。 (我使用的是默认播放器,没有任何自定义) 谁能帮我解决这个问题?
我的代码:
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/playerView"
android:focusable="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
var player:SimpleExoPlayer?=null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.pdf_view_normal)
player = ExoPlayerFactory.newSimpleInstance(this)
val mediaDataSourceFactory = DefaultDataSourceFactory(this,getUserAgent(this,"demo.smart.com"))
val mediaSource = ProgressiveMediaSource.Factory(mediaDataSourceFactory)
.createMediaSource(Uri.parse(""))
with(player) {
this!!.prepare(mediaSource,false,false)
playWhenReady = true
}
playerView.setShutterBackgroundColor(Color.TRANSPARENT)
playerView.player = player
playerView.requestFocus()
}
override fun onDestroy() {
super.onDestroy()
if(player!=null){
player!!.stop()
}
}
摇篮
android{
kotlinOptions {
jvmTarget = "1.8"
}
..
}
implementation 'com.google.android.exoplayer:exoplayer:2.10.8'
所有日志供您参考
Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{demo.smart.com.Viewer}: android.view.InflateException: Binary XML file line #11: Binary XML file line #11: Error inflating class com.google.android.exoplayer2.ui.PlayerView
Caused by android.view.InflateException
Binary XML file line #11: Binary XML file line #11: Error inflating class com.google.android.exoplayer2.ui.PlayerView
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。