无法在Android中解析符号Youtube

时间:2016-09-01 22:06:06

标签: android youtube android-youtube-api

我真的很沮丧,我按照所有步骤在我的android项目中为youtube添加google api并且我仍然有这个错误:无法解析符号Youtube

这是我的java类:

  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);
    }

这是我的app gradle文件:

     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'

我做错了什么?

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

我解决了声明错误的问题:我必须将youtube声明为YouTube对象而不是Youtube。