YouTube Api for android exception “service_missing”

I want to play you tube video in my android application

I got exception while youtube initialization like "service_missing".

I write following code,

package com.example.youtubedemo;

import android.os.Bundle;

import android.view.Menu;
import android.widget.Toast;




public class MainActivity extends YouTubeBaseActivity implements OnInitializedListener{

    static private final String DEVELOPER_KEY = "MY API KEY";

    static private final String VIDEO =";

    protected void onCreate(Bundle savedInstanceState) {
        YouTubePlayerView youTubeView = (YouTubePlayerView)
        youTubeView.initialize(DEVELOPER_KEY, MainActivity.this);

    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(, menu);
        return true;

    public void onInitializationFailure(Provider arg0,YouTubeInitializationResult error) {
        Toast.makeText(this, "Oh no! "+error.toString(),Toast.LENGTH_LONG).show();

        Toast.makeText(this, ""+YouTubeInitializationResult.SERVICE_MISSING,Toast.LENGTH_LONG).show();

    public void onInitializationSuccess(Provider arg0, YouTubePlayer player,
            boolean arg2) {



I had also given INTERNET users permission.

I test this code in 4.2.2 With google API AVD.



Any one have any idea??

thanks in advance...


As the API documentation for the Youtube API states:

YouTubeInitializationResult.SERVICE_MISSING The YouTube API service is missing on this device.

You'll need to install the Youtube app into the emulator to make it work.

Need Your Help

C++ Invalid use of member function, did you forget the ( )?

c++ templates compiler-errors containers member

I'm working on an assignment where I create my own container using templates. The container I am required to use is called Smaph, which takes in two pairs of numbers and does a variety of functions...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.