nyaa
nyaa

Reputation: 1736

Unable to start activity - YouTubeStandalonePlayer

I am trying to use YouTubeStandalonePlayer from https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeStandalonePlayer

With this code inside onCreate():

Intent intent = YouTubeStandalonePlayer.createVideoIntent(this, DeveloperKey.DEVELOPER_KEY, VIDEO_ID);
startActivity(intent);

But application fails with error.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.youtubestandalone/com.example.youtubestandalone.MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.android.youtube.api.StandalonePlayerActivity.START (has extras) }

How to fix this?

Upvotes: 0

Views: 3505

Answers (2)

kinni
kinni

Reputation: 11

Check if you have include the jar file in your project. Make sure you have done the follow steps.

  1. Right Click your project
  2. Select Properties
  3. Select Java Build Path
  4. Go to Order and Export Tab
  5. Tick YouTubeAndroidPlayerApi

Good luck!

Upvotes: 1

Biraj Zalavadia
Biraj Zalavadia

Reputation: 28484

Add this line to your AndroidManifest.xml

<activity
            android:name="com.google.android.youtube.api.StandalonePlayerActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
 />

Upvotes: 2

Related Questions