0

情况:将我的 Android 项目从带有 VisualOn 的旧 Ooyala SDK 更新到带有 Exoplyer 的最新 Ooyala SDK。通过 Amazon Fire Stick 播放视频。

问题:更新 SDK 后,项目不再工作。我们收到此错误消息:

  • “E/AndroidRuntime:致命异常:主进程:com.ISN.firetv_isn,PID:19650 java.lang.NoClassDefFoundError:com.ooyala.android.player.exoplayer.ExoStreamPlayer”

查看 NoClassDefFoundError,我觉得代码缺少包的导入(但是,总的来说我不知道​​)。

.

请帮我定位问题。有什么解决办法?


Android Studio 错误日志:

07-12 07:15:15.141 19650-19650/com.ISN.firetv_isn E/AndroidRuntime: FATAL EXCEPTION: main
                                                                    Process: com.ISN.firetv_isn, PID: 19650
                                                                    java.lang.NoClassDefFoundError: com.ooyala.android.player.exoplayer.ExoStreamPlayer
                                                                        at com.ooyala.android.player.ExoMoviePlayer.createStreamPlayer(ExoMoviePlayer.java:12)
                                                                        at com.ooyala.android.player.MoviePlayer.init(MoviePlayer.java:50)
                                                                        at com.ooyala.android.OoyalaPlayerContextSwitcher.createAndInitPlayer(OoyalaPlayerContextSwitcher.java:107)
                                                                        at com.ooyala.android.OoyalaPlayer.prepareContent(OoyalaPlayer.java:1469)
                                                                        at com.ooyala.android.OoyalaPlayerContextSwitcher.processExitAdModes(OoyalaPlayerContextSwitcher.java:182)
                                                                        at com.ooyala.android.OoyalaPlayerContextSwitcher.processAdModes(OoyalaPlayerContextSwitcher.java:162)
                                                                        at com.ooyala.android.OoyalaPlayerContextSwitcher.startVideoWorkflow(OoyalaPlayerContextSwitcher.java:61)
                                                                        at com.ooyala.android.OoyalaPlayer.onCurrentItemChangeComplete(OoyalaPlayer.java:697)
                                                                        at com.ooyala.android.OoyalaPlayer.access$200(OoyalaPlayer.java:68)
                                                                        at com.ooyala.android.OoyalaPlayer$1$1.run(OoyalaPlayer.java:510)
                                                                        at android.os.Handler.handleCallback(Handler.java:739)
                                                                        at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                        at android.os.Looper.loop(Looper.java:135)
                                                                        at android.app.ActivityThread.main(ActivityThread.java:5484)
                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                        at java.lang.reflect.Method.invoke(Method.java:372)
                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
07-12 07:15:15.423 19852-19852/? E/VendorContextExt: Failed to register system service "com.amazon.client.metrics.AndroidMetricsFactoryImpl". The class was not found for the provided classloader.
07-12 07:15:15.806 19044-19867/? E/AmazonAppstore.SideloadedAppManagerService: cannot update entry for package::com.ISN.firetv_isn
07-12 07:15:16.317 19819-19837/? E/SQLiteLog: (283) recovered 3 frames from WAL file /data/user/0/com.amazon.ags.app/databases/gamecircle_provider.db-wal
07-12 07:15:16.334 1005-1050/? E/InputDispatcher: channel '37e18ebe com.ISN.firetv_isn/com.isn.firetv_isn.KindlePlayer (server)' ~ Channel is unrecoverably broken and will be disposed!


代码

package com.isn.firetv_isn;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.ooyala.android.*;

import com.ooyala.android.OoyalaPlayer;
import com.ooyala.android.OoyalaPlayerLayout;
import com.ooyala.android.PlayerDomain;


import com.ooyala.android.ui.OoyalaPlayerLayoutController;

import java.util.Observable;
import java.util.Observer;

public class KindlePlayer extends Activity implements Observer {

    private static final String TAG = "This";
    private static final String EMBED  = "a";  //Embed Code, or Content ID
    private static final String PCODE  = "b";
    private static final String DOMAIN = "http://www.ooyala.com";
    private OoyalaPlayer player;
    View decorView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                | View.SYSTEM_UI_FLAG_IMMERSIVE);
        setContentView(R.layout.video_player);
        decorView = this.getWindow().getDecorView();

        OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer);
        player = new OoyalaPlayer(PCODE, new PlayerDomain(DOMAIN));

        //set player controller
        OoyalaPlayerLayoutController playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, player);
        playerLayoutController.setFullscreenButtonShowing(false);

        //player = playerLayoutController.getPlayer();
        if(isConnectedOnline()){
            ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
            if(cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_MOBILE){
                Toast.makeText(KindlePlayer.this, "Now using Mobile Network", Toast.LENGTH_SHORT).show();
            }
            if (player.setEmbedCode(EMBED)) {
                Log.d("Play", "Play");
                player.play();
            } else {
                Log.d(TAG, "Asset failed");
            }
        } else {
            Toast.makeText(KindlePlayer.this, "No Internet Connection", Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
        if (player != null) {
            Log.d("suspend", "suspend");
            player.pause();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (player != null) {
            Log.d("resume", "resume");
            player.resume();
            player.play();
        }
    }

    @Override
    public void update(Observable arg0, Object arg1) {
        if (arg0 != player) {
            return;
        }

        if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME) {
            return;
        }

        if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION_NAME) {
            final String msg = "Error event received";
            if (player != null && player.getError() != null) {
                Log.e(TAG, msg, player.getError());
            }
            else {
                Log.e(TAG, msg);
            }
            return;
        }
        Log.d(KindlePlayer.class.getSimpleName(), "Notification Received: " + arg1 + " - state: " + player.getState());
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (hasFocus) {
            decorView.setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_IMMERSIVE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
    }

    public boolean isConnectedOnline() {
        ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo ni = cm.getActiveNetworkInfo();
        return ni != null && ni.isConnected();
    }// end isConnectedOnline
}

4

1 回答 1

1

向此线程添加更多信息,您可以使用我们的示例应用程序作为在您的应用程序中集成 SDK 和其他所需功能的指南。

请访问我们的示例应用程序文档网站:

http://help.ooyala.com/video-platform/concepts/mobile_sdk_android_sampleapps.html

问候, Ooyala 技术支持工程团队

于 2017-07-20T19:29:02.187 回答