适用于Android的Brightcove Native SDK提供NoClassDefFoundError



我的Android应用程序与Brightcove Native SDK for Android发生崩溃。安卓工作室日志显示-

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/exoplayer2/drm/DefaultDrmSessionEventListener; 

活动类别-

public class SetActivity extends BrightcovePlayer {
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_set);
BrightcoveExoPlayerVideoView brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
super.onCreate(savedInstanceState);

// Define a video from a remote server
Video video = Video.createVideo("https://learning-services-media.brightcove.com/videos/hls/greatblueheron/greatblueheron.m3u8", DeliveryType.HLS);
// Load a remote poster image
try {
java.net.URI myposterImage = new java.net.URI("https://solutions.brightcove.com/bcls/assets/images/Great-Blue-Heron.png");
video.getProperties().put(Video.Fields.STILL_IMAGE_URI, myposterImage);
} catch (URISyntaxException e) {
e.printStackTrace();
}
// Add video to the view
brightcoveVideoView.add(video);
// Start video playback
brightcoveVideoView.start();

}

}

XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".general_activities.SetActivity">

<com.brightcove.player.view.BrightcoveExoPlayerVideoView
android:id="@+id/brightcove_video_view"
android:layout_width="match_parent"
android:layout_height="280dp"
/>

</RelativeLayout>

编译代码中的ExoPlayer版本与Brightcove SDK使用的ExoPlayer版本不一致。

我在这里回忆起模糊的记忆,但我认为谷歌在ExoPlayer2.14+.版本中改变了DefaultDrmSessionEventListener类的路径

Brightcove SDK是根据旧版本的ExoPlayer编译的,您需要将ExoPlayer依赖版本与ExoPlayer的Brightcov SDK依赖版本对齐。

最新更新