Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol Youtube in Android

I am really frustrated with this I followed all the steps to add the google api for youtube in my android project and I still having this error: Cannot resolve symbol Youtube

Here is my java class:

  import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;

import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubeThumbnailLoader;
import  com.google.api.services.youtube.YouTube;


import java.util.List;




public class VideoCatalogActivity extends Activity implements YouTubeThumbnailLoader, YouTubePlayer{

    private static final String TAG =  VideoCatalogActivity.class.getSimpleName();

    private static Youtube youtube;

    GridView videosGrid;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
    }

and this is my app gradle file:

     buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }

    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile files('libs/picasso-2.4.0.jar')
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:recyclerview-v7:24.2.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.google.firebase:firebase-core:9.4.0'
    compile 'com.google.firebase:firebase-auth:9.4.0'
    compile 'com.google.android.gms:play-services-auth:9.4.0'
    compile 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0'

    testCompile 'junit:junit:4.12'

}

apply plugin: 'com.google.gms.google-services'

What am I doing wrong ?

Any help would be very appreciated !

like image 301
skylight Avatar asked Nov 09 '22 09:11

skylight


1 Answers

I solved the problem the declaration was wrong: i had to declare youtube as YouTube object not Youtube.

like image 91
skylight Avatar answered Nov 15 '22 06:11

skylight