我正在使用Brightcove sdk for android。
我在libs文件夹中添加了sdk,并将其添加到依赖项中。
我正在使用的代码是
public class MainActivity extends BrightcovePlayer {
//private final String TAG = this.getClass().getSimpleName();
private EventEmitter eventEmitter;
// BrightcoveVideoView brightcoveVideoView;
//private GoogleIMAComponent googleIMAComponent;
private String adRulesURL = "http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=%2F15018773%2Feverything2&ciu_szs=300x250%2C468x60%2C728x90&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=dummy&correlator=[timestamp]&cmsid=133&vid=10XWSh7W4so&ad_rule=1";
@Override
protected void onCreate(Bundle savedInstanceState) {
// When extending the BrightcovePlayer, we must assign the BrightcoveVideoView before
// entering the superclass. This allows for some stock video player lifecycle
// management.
setContentView(R.layout.activity_main);
BrightcoveVideoView brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
super.onCreate(savedInstanceState);
brightcoveVideoView.add(Video.createVideo("http://solutions.brightcove.com/bcls/assets/videos/Bird_Titmouse.mp4", DeliveryType.MP4));
brightcoveVideoView.start();
和布局文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<com.brightcove.player.view.BrightcoveVideoView
android:id="@+id/brightcove_video_view"
android:layout_width="match_parent"
android:layout_height="280dp"
android:layout_gravity="center_horizontal|center_vertical" />
我得到的错误是
6366-6366/E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.brightcove.player.R$layout
at com.brightcove.player.controller.BrightcoveClosedCaptioningController.makeCaptionsDialog(BrightcoveClosedCaptioningController.java:114)
at com.brightcove.player.controller.BrightcoveClosedCaptioningController.<init>(BrightcoveClosedCaptioningController.java:102)
at com.brightcove.player.view.BaseVideoView.setEventEmitter(BaseVideoView.java:298)
at com.brightcove.player.view.BrightcoveVideoView.setEventEmitter(BrightcoveVideoView.java:149)
at com.brightcove.player.view.BaseVideoView.onFinishInflate(BaseVideoView.java:255)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:747)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
at android.app.Activity.setContentView(Activity.java:1835)
at com.testproject.myapplication.MainActivity.onCreate(MainActivity.java:50)
at android.app.Activity.performCreate(Activity.java:4470)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
at android.app.ActivityThread.access$600(ActivityThread.java:128)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
错误是什么。我无法理解。
答案 0 :(得分:2)
我们最近添加了对pre-Kitkat上自定义隐藏式字幕样式的支持,并且对话框需要一些资源,例如布局。这些资源包含在.aar文件中,在使用gradle和Android Studio进行编译时应使用该文件。 Android Studio已达到1.0,因此我们建议在命令行上使用它或gradle以使用Brightcove SDK进行开发。对于遗留Eclipse开发,我们提供传统jar,但现在需要资源,您还必须使用apklib文件。 4.3.0版本中缺少SDK apklib文件,但它将包含在下一版本中。如果你不能脱离Eclipse,要取消阻止,你应该回到使用4.2.7版本,直到4.3.1出来。
答案 1 :(得分:0)
补充这个问题:
注意:现在不推荐支持Android版本2.3.3和4.0。 详细了解Brightcove为何删除对这些版本的支持 截至2016年1月1日的公告。
http://docs.brightcove.com/en/perform/mobile-sdks/brightcove-player-sdk-for-android/index.html