Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Error YouTubePlayerView XML

$
0
0

I'm trying to put a YouTubePlayerView inside my Adapter but I didn't have success.

I don't want to call a new Intent. I want to show the video inside my app.

I put the YouTubeAndroidPlayerApi.jar inside my folder libs and look at the project properties and it's all ok (I followed this tutorial)

Here's is my XML code and the log.

<LinearLayout        android:id="@+id/ll_contentExercicios_LayoutVideoGif"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:orientation="horizontal"><com.google.android.youtube.player.YouTubePlayerView             android:id="@+id/vv_contentExercicios_YoutubeVideo"            android:layout_width="300dp"            android:layout_height="150dp" /><ImageView            android:id="@+id/iv_contentExercicios_GifExercicio"            android:layout_width="100dp"            android:layout_height="150dp"            android:layout_marginLeft="30dp"></ImageView></LinearLayout>
10-29 13:03:42.598: E/AndroidRuntime(4513): FATAL EXCEPTION: main10-29 13:03:42.598: E/AndroidRuntime(4513): java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.timo.atlas/br.com.timo.atlas.PrincipalActivity}: android.view.InflateException: Binary XML file line #121: Error inflating class com.google.android.youtube.player.YouTubePlayerView10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.app.ActivityThread.access$600(ActivityThread.java:140)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.os.Handler.dispatchMessage(Handler.java:99)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.os.Looper.loop(Looper.java:137)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.app.ActivityThread.main(ActivityThread.java:4895)10-29 13:03:42.598: E/AndroidRuntime(4513):     at java.lang.reflect.Method.invokeNative(Native Method)10-29 13:03:42.598: E/AndroidRuntime(4513):     at java.lang.reflect.Method.invoke(Method.java:511)10-29 13:03:42.598: E/AndroidRuntime(4513):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)10-29 13:03:42.598: E/AndroidRuntime(4513):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)10-29 13:03:42.598: E/AndroidRuntime(4513):     at dalvik.system.NativeStart.main(Native Method)10-29 13:03:42.598: E/AndroidRuntime(4513): Caused by: android.view.InflateException: Binary XML file line #121: Error inflating class com.google.android.youtube.player.YouTubePlayerView10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)10-29 13:03:42.598: E/AndroidRuntime(4513):     at br.com.timo.atlas.adapters.ExerciciosAdapter.getView(ExerciciosAdapter.java:107)10-29 13:03:42.598: E/AndroidRuntime(4513):     at br.com.timo.atlas.adapters.MusculoAdapter.getView(MusculoAdapter.java:185)10-29 13:03:42.598: E/AndroidRuntime(4513):     at br.com.timo.atlas.PrincipalActivity.onCreate(PrincipalActivity.java:275)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.app.Activity.performCreate(Activity.java:5163)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)10-29 13:03:42.598: E/AndroidRuntime(4513):     ... 11 more10-29 13:03:42.598: E/AndroidRuntime(4513): Caused by: java.lang.reflect.InvocationTargetException10-29 13:03:42.598: E/AndroidRuntime(4513):     at java.lang.reflect.Constructor.constructNative(Native Method)10-29 13:03:42.598: E/AndroidRuntime(4513):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)10-29 13:03:42.598: E/AndroidRuntime(4513):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)10-29 13:03:42.598: E/AndroidRuntime(4513):     ... 23 more10-29 13:03:42.598: E/AndroidRuntime(4513): Caused by: java.lang.IllegalStateException: A YouTubePlayerView can only be created with an Activity  which extends YouTubeBaseActivity as its context.10-29 13:03:42.598: E/AndroidRuntime(4513):     at com.google.android.youtube.player.YouTubePlayerView.(Unknown Source)10-29 13:03:42.598: E/AndroidRuntime(4513):     at com.google.android.youtube.player.YouTubePlayerView.(Unknown Source)10-29 13:03:42.598: E/AndroidRuntime(4513):     ... 26 more

P.S.: I was reading the Youtube API documentation and it said that it is necessary an activity extends a YouTubeBaseActivity to use an YouTubePlayerView so I know I will need some way to create the YouTubePlayerView inside my BaseAdapter.

Thanks and regards.


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>