在我们的项目中,我使用exoplayer 2.2.0版(com.google.android.exoplayer:exoplayer:r2.2.0),但我们需要将google ima广告与exoplayer集成,以便使用exoplayer添加ima扩展名(com.google.android.exoplayer:extension-ima:r2.5.1)我将exoplayer的版本升级到2.5.1(com.google.android.exoplayer:exoplayer:r2.5.1)。当我运行项目时由于" InflateException"它正在崩溃。 请帮忙。
记录:
FATAL EXCEPTION: main
Process: com.indiatoday, PID: 12342
android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.google.android.exoplayer2.ui.SimpleExoPlayerView
android.view.LayoutInflater.inflate(LayoutInflater.java:543)
android.view.LayoutInflater.inflate(LayoutInflater.java:427)
android.view.LayoutInflater.inflate(LayoutInflater.java:374)
布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/exo_player"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:controller_layout_id="@layout/exo_playback_control_view"
app:resize_mode="fill"
app:surface_type="texture_view" />
</LinearLayout>
代码:
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.video_detail_view, container, false);
initView(rootView);
getLocalArguments();
setPlayer();
return rootView;
}