【问题标题】:Brightcove Native SDK for Android gives NoClassDefFoundError适用于 Android 的 Brightcove Native SDK 提供 NoClassDefFoundError
【发布时间】:2021-10-06 02:40:40
【问题描述】:

使用适用于 Android 的 Brightcove Native SDK 时,我的 Android 应用程序崩溃了。 Android Studio 日志显示-

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>

【问题讨论】:

    标签: android brightcove


    【解决方案1】:

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

    我从模糊的记忆中回忆,但我认为 Google 在 ExoPlayer 2.14+ 版本中更改了 DefaultDrmSessionEventListener 类的路径。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多