YouTubePlayerSupportFragment 和 AppCompatActivity 错误
YouTubePlayerSupportFragment and AppCompatActivity error
我正在开发使用 YouTube 的应用程序 android API。
为了播放视频,我使用了 YouTubePlayerFragment。
当我从 Activity class 扩展我的 activity 时,一切正常,但是当我切换到 AppCompatActivity 和 YouTubePlayerSupportFragment 视频无法启动时,我看到了logcat 中的这些错误:
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: Error creating YouTubePlayerView
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: com.google.android.youtube.player.internal.w$a: Exception thrown by invoked constructor in com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.ac.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r.g(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Handler.dispatchMessage(Handler.java:102)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Looper.loop(Looper.java:146)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.app.ActivityThread.main(ActivityThread.java:5603)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invoke(Method.java:515)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dalvik.system.NativeStart.main(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: Caused by: java.lang.reflect.InvocationTargetException
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.constructNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.ac.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r.g(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Handler.dispatchMessage(Handler.java:102)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Looper.loop(Looper.java:146)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.app.ActivityThread.main(ActivityThread.java:5603)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invoke(Method.java:515)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dalvik.system.NativeStart.main(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: Caused by: android.view.InflateException: Binary XML file line #91: Error inflating class ImageView
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dbz.<init>(SourceFile:69)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at afh.<init>(SourceFile:115)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:175)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:158)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:145)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.constructNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.ac.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r.g(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Handler.dispatchMessage(Handler.java:102)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Looper.loop(Looper.java:146)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.app.ActivityThread.main(ActivityThread.java:5603)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invoke(Method.java:515)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dalvik.system.NativeStart.main(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: Caused by: java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable cannot be cast to android.graphics.drawable.LayerDrawable
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:202)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:170)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.internal.widget.TintTypedArray.getDrawable(TintTypedArray.java:62)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:45)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:56)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.internal.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:98)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:926)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:980)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dbz.<init>(SourceFile:69)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at afh.<init>(SourceFile:115)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:175)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:158)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:145)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.constructNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.ac.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r.g(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Handler.dispatchMessage(Handler.java:102)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Looper.loop(Looper.java:146)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.app.ActivityThread.main(ActivityThread.java:5603)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invoke(Method.java:515)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dalvik.system.NativeStart.main(Native Method)
是否可以将 YouTubePlayerSupportFragment 与 AppCompatActivity 一起使用?
在您的应用中使用给定的代码build.gradle
compile 'com.android.support:appcompat-v7:23.0.1'
更换最新版本即可解决此问题。
我不知道为什么。谁知道是什么原因,求解释一下
这是因为最新版本 23.4+ 不稳定且存在问题。最新和稳定的版本是 23.1.1
使用这个可以避免这个问题。
我正在开发使用 YouTube 的应用程序 android API。
为了播放视频,我使用了 YouTubePlayerFragment。
当我从 Activity class 扩展我的 activity 时,一切正常,但是当我切换到 AppCompatActivity 和 YouTubePlayerSupportFragment 视频无法启动时,我看到了logcat 中的这些错误:
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: Error creating YouTubePlayerView
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: com.google.android.youtube.player.internal.w$a: Exception thrown by invoked constructor in com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.ac.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r.g(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Handler.dispatchMessage(Handler.java:102)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Looper.loop(Looper.java:146)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.app.ActivityThread.main(ActivityThread.java:5603)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invoke(Method.java:515)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dalvik.system.NativeStart.main(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: Caused by: java.lang.reflect.InvocationTargetException
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.constructNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.ac.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r.g(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Handler.dispatchMessage(Handler.java:102)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Looper.loop(Looper.java:146)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.app.ActivityThread.main(ActivityThread.java:5603)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invoke(Method.java:515)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dalvik.system.NativeStart.main(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: Caused by: android.view.InflateException: Binary XML file line #91: Error inflating class ImageView
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dbz.<init>(SourceFile:69)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at afh.<init>(SourceFile:115)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:175)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:158)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:145)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.constructNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.ac.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r.g(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Handler.dispatchMessage(Handler.java:102)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Looper.loop(Looper.java:146)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.app.ActivityThread.main(ActivityThread.java:5603)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invoke(Method.java:515)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dalvik.system.NativeStart.main(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: Caused by: java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable cannot be cast to android.graphics.drawable.LayerDrawable
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:202)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:170)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.internal.widget.TintTypedArray.getDrawable(TintTypedArray.java:62)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:45)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:56)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.internal.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:98)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:926)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:980)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dbz.<init>(SourceFile:69)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at afh.<init>(SourceFile:115)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:175)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:158)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.<init>(SourceFile:145)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.constructNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.w.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.ac.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r.g(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Handler.dispatchMessage(Handler.java:102)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.os.Looper.loop(Looper.java:146)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at android.app.ActivityThread.main(ActivityThread.java:5603)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invokeNative(Native Method)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at java.lang.reflect.Method.invoke(Method.java:515)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
11-09 21:43:42.770 28199-28199/org.appspot.apprtc E/YouTubeAndroidPlayerAPI: at dalvik.system.NativeStart.main(Native Method)
是否可以将 YouTubePlayerSupportFragment 与 AppCompatActivity 一起使用?
在您的应用中使用给定的代码build.gradle
compile 'com.android.support:appcompat-v7:23.0.1'
更换最新版本即可解决此问题。
我不知道为什么。谁知道是什么原因,求解释一下
这是因为最新版本 23.4+ 不稳定且存在问题。最新和稳定的版本是 23.1.1 使用这个可以避免这个问题。