>情况:将我的 Android 项目从旧的 Ooyala SDK with VisualOn 更新到最新的 Ooyala SDK with Exoplyer。通过亚马逊火棒播放视频。
问题:更新 SDK 后,项目不再有效。我们收到以下错误消息:
- "E/Android运行时:致命异常:main 流程:com.ISN.firetv_isn,PID:19650 java.lang.NoClassDefFoundError: com.ooyala.android.player.exoplayer.ExoStreamPlayer">
查看NoClassDefFoundError,我觉得代码缺少包的导入(但是,总的来说我不知道(。
.
请帮我找到问题所在。解决方案是什么?
安卓工作室错误日志:
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
}
向此线程添加更多信息后,可以使用我们的示例应用作为在应用中集成 SDK 和其他所需功能的指南。
请访问我们的示例应用文档网站:
http://help.ooyala.com/video-platform/concepts/mobile_sdk_android_sampleapps.html
问候 奥亚拉技术支持工程团队