Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 未配置访问权限。请使用Google开发者控制台激活youtube搜索列表项目的API_Android_Youtube_Youtube Data Api - Fatal编程技术网

Android 未配置访问权限。请使用Google开发者控制台激活youtube搜索列表项目的API

Android 未配置访问权限。请使用Google开发者控制台激活youtube搜索列表项目的API,android,youtube,youtube-data-api,Android,Youtube,Youtube Data Api,我实现了youtube搜索列表 但是这个错误 未配置访问权限。请使用Google开发者控制台为您的项目激活API 代码:- youtube = new YouTube.Builder(transport,jsonFactory, new HttpRequestInitializer() { @Override public void initialize(HttpRequest request) throws IOException { } }).setApplicat

我实现了youtube搜索列表

但是这个错误

未配置访问权限。请使用Google开发者控制台为您的项目激活API

代码:-

youtube = new YouTube.Builder(transport,jsonFactory, new HttpRequestInitializer() 
{
    @Override
    public void initialize(HttpRequest request) throws IOException {
    }
}).setApplicationName("youtube-cmdline-search-sample").build();


String queryTerm = getInputQuery();

// Define the API request for retrieving search results.
YouTube.Search.List search = youtube.search().list("id,snippet");

// Set your developer key from the Google Developers Console for

String apiKey = ""; //i have server key and browser key
search.setKey(apiKey);
search.setQ(queryTerm);

search.setType("video");

search.setFields("items(id/kind,id/videoId,snippet/title,snippet/thumbnails/default/url)");
search.setMaxResults(NUMBER_OF_VIDEOS_RETURNED);

您需要为youtube应用程序激活google api。通过登录谷歌开发者帐户。选择API,应列出您需要启用youtube API并粘贴到与您的帐户关联的API访问密钥中的所有google API的列表

// Set your developer key from the Google Developers Console for

String apiKey = ""; //i have server key and browser key
search.setKey(apiKey);
search.setQ(queryTerm)

您是否确保在开发人员控制台中,推荐人字段为空?

解决方案:-

我从旧的开发者控制台站点创建了这个项目


我使用了旧开发人员控制台站点上的浏览器密钥。

我在创建“服务器密钥”时收到了这个错误,我列出的IP与客户端的IP(我运行应用程序的地方)不匹配。

哇!是的,使用旧的开发者控制台。我花了一整天的时间才找到答案。在新开发人员控制台上有一个到旧开发人员控制台的链接。在旧控制台中生成一个新密钥,它就会工作!这太糟糕了。

我也有同样的问题。我禁用了API,然后重新启用它,然后它工作了。

现在在字符串apikey=(您的API在这里)中输入您的API密钥,这应该可以解决您的问题。我添加了浏览器密钥和服务器密钥,但出现了相同的错误,请尝试实现此库,因为它已更新为v3支持。哇!这件事困扰了我好长时间。真不敢相信新的游戏机就是不工作……谁会在我的答案上留下这些评分?请解释一下。我只是确认了AnilPatel发布的内容,并添加了一些细节。你知道,像AnilPatel posted这样的解决方案听起来有些古怪,我只是简单地证实了这一点。我照他说的做了,这对我很有效,这就是我所能说的。。。