2015-05-05 39 views
0

我編譯ChromeCast這個Github項目CastVideos-android。在Eclipse環境中。我在項目中安裝了最新的依賴關係。Android GoogleCast錯誤 - java.lang.NoClassDefFoundError:android.support.v7.media.MediaRouterGlobalMediaRouter

enter image description here enter image description here

當我運行的項目,其拋出此運行時錯誤。

05-05 11:25:08.353: E/AndroidRuntime(17660): FATAL EXCEPTION: main 
    05-05 11:25:08.353: E/AndroidRuntime(17660): java.lang.NoClassDefFoundError: android.support.v7.media.MediaRouter$GlobalMediaRouter$1 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.support.v7.media.MediaRouter$GlobalMediaRouter.<init>(MediaRouter.java:1628) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.support.v7.media.MediaRouter.getInstance(MediaRouter.java:246) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at com.google.android.libraries.cast.companionlibrary.cast.BaseCastManager.<init>(BaseCastManager.java:189) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.<init>(VideoCastManager.java:196) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.initialize(VideoCastManager.java:223) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at com.google.sample.cast.refplayer.CastApplication.onCreate(CastApplication.java:43) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4280) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.app.ActivityThread.access$1400(ActivityThread.java:143) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1301) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.os.Handler.dispatchMessage(Handler.java:99) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.os.Looper.loop(Looper.java:137) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at android.app.ActivityThread.main(ActivityThread.java:4950) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at java.lang.reflect.Method.invokeNative(Native Method) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at java.lang.reflect.Method.invoke(Method.java:511) 
    05-05 11:25:08.353: E/AndroidRuntime(17660):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:997) 


    05-05 11:25:08.303: E/dalvikvm(17660): Could not find class 'android.support.v7.media.MediaRouter$GlobalMediaRouter$1', referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.<init> 
    05-05 11:25:08.303: W/dalvikvm(17660): VFY: unable to resolve new-instance 1180 (Landroid/support/v7/media/MediaRouter$GlobalMediaRouter$1;) in Landroid/support/v7/media/MediaRouter$GlobalMediaRouter; 
    05-05 11:25:08.303: D/dalvikvm(17660): VFY: replacing opcode 0x22 at 0x0035 
    05-05 11:25:08.303: W/dalvikvm(17660): VFY: unable to find class referenced in signature (Landroid/support/v4/media/session/MediaSessionCompat;) 
    05-05 11:25:08.313: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.getSessionToken, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.getMediaSessionToken 
    05-05 11:25:08.313: W/dalvikvm(17660): VFY: unable to resolve virtual method 2967: Landroid/support/v4/media/session/MediaSessionCompat;.getSessionToken()Landroid/support/v4/media/session/MediaSessionCompat$Token; 
    05-05 11:25:08.313: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x0011 
    05-05 11:25:08.323: W/dalvikvm(17660): VFY: unable to find class referenced in signature (Landroid/support/v4/media/session/MediaSessionCompat;) 
    05-05 11:25:08.323: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.getRemoteControlClient, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.setMediaSessionCompat 
    05-05 11:25:08.323: W/dalvikvm(17660): VFY: unable to resolve virtual method 2966: Landroid/support/v4/media/session/MediaSessionCompat;.getRemoteControlClient()Ljava/lang/Object; 
    05-05 11:25:08.323: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x000a 
    05-05 11:25:08.323: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.getMediaSession, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.setMediaSessionCompat 
    05-05 11:25:08.323: W/dalvikvm(17660): VFY: unable to resolve virtual method 2965: Landroid/support/v4/media/session/MediaSessionCompat;.getMediaSession()Ljava/lang/Object; 
    05-05 11:25:08.323: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x001e 
    05-05 11:25:08.333: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.getRemoteControlClient, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.setMediaSessionCompat 
    05-05 11:25:08.333: W/dalvikvm(17660): VFY: unable to resolve virtual method 2966: Landroid/support/v4/media/session/MediaSessionCompat;.getRemoteControlClient()Ljava/lang/Object; 
    05-05 11:25:08.333: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x0032 
    05-05 11:25:08.333: I/dalvikvm(17660): Could not find method android.support.v4.media.session.MediaSessionCompat.addOnActiveChangeListener, referenced from method android.support.v7.media.MediaRouter$GlobalMediaRouter.setMediaSessionCompat 
    05-05 11:25:08.333: W/dalvikvm(17660): VFY: unable to resolve virtual method 2964: Landroid/support/v4/media/session/MediaSessionCompat;.addOnActiveChangeListener (Landroid/support/v4/media/session/MediaSessionCompat$OnActiveChangeListener;)V 
    05-05 11:25:08.333: D/dalvikvm(17660): VFY: replacing opcode 0x6e at 0x0044 
    05-05 11:25:08.333: I/dalvikvm(17660): Failed resolving Landroid/support/v7/media/MediaRouter$GlobalMediaRouter$1; interface 510 'Landroid/support/v4/media/session/MediaSessionCompat$OnActiveChangeListener;' 
    05-05 11:25:08.333: W/dalvikvm(17660): Link of class 'Landroid/support/v7/media/MediaRouter$GlobalMediaRouter$1;' failed 

enter image description here

enter image description here

+0

檢查'buildpath'。特別是'訂購和出口'部分,如果您的'支持庫'被選中 – hrskrs

+0

沒有選擇支持庫..請參閱屏幕截圖 – san88

+0

當我說'支持庫',我的意思是'v7-appcompat庫' – hrskrs

回答

2
  1. 轉到您的項目,並檢查v7-appcompat jar文件。右鍵點擊它並且Build Path-> Add to Buildpath

  2. 檢查buildpath。具體Order and Export部分,如果你的 v7-appcompat library檢查

  3. 檢查項目包含多個support-v7 library。一個是 在您的項目,另一個是在您的項目中添加 的庫中。只需刪除您已添加到 您的項目中的一個庫。然後清理並運行您的應用程序