Search code examples
androidbrightcove

Brightcove sdk for android, example not working


I am using Brightcove sdk for android.

I added the sdk in libs folder and added it in the dependencies also.

and the code that i am using is

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();

and the layout file

<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" />

and the error i got is

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)

What is the error. I couldn't understand.


Solution

  • We recently added support for customizing closed captioning styles on pre-Kitkat and the dialog requires some resources, like the layout. These resources are included in the .aar file, which should be used when compiling with gradle and Android Studio. Android Studio has reached 1.0, so we recommend using that or gradle on the command line for development with the Brightcove SDK. For legacy Eclipse development, we ship legacy jars, but now that resources are required, you'll also have to use apklib files. The SDK apklib file was missing from the 4.3.0 release, but it will be included in the next release. If you can't get off Eclipse, to get unblocked, you should go back to using the 4.2.7 release until 4.3.1 comes out.