Har*_*r S 7 crash android invocationtargetexception inflate-exception exoplayer2.x
Exoplayer2 在三星、Vivo、小米等设备的发布和调试版本中运行良好。但是,当我在 Play 商店上发布我的应用程序时,它在某些设备(例如 Nexus、Pixel 手机)上抛出错误。
Crashlytics showing this error: Caused by android.view.InflateException:
Binary XML file line #11: Error inflating class com.google.android.exoplayer2.ui.PlayerView
Run Code Online (Sandbox Code Playgroud)
我发现已经就同一问题提出了一些类似的问题,但对我来说没有任何用处。(我使用的是默认播放器,没有任何自定义)任何人都可以帮我解决这个问题吗?
我的代码:
<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()
}
}
Run Code Online (Sandbox Code Playgroud)
摇篮
android{
kotlinOptions {
jvmTarget = "1.8"
}
..
}
implementation 'com.google.android.exoplayer:exoplayer:2.10.8'
Run Code Online (Sandbox Code Playgroud)
所有日志供您参考
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1215 次 |
| 最近记录: |