问题与Android工作室的Youtube进口。 “YouTubePlayerSupportFragment无法解析” [英] Issue with Android Studio Youtube imports. 'YouTubePlayerSupportFragment cannot be resolved'

查看:527
本文介绍了问题与Android工作室的Youtube进口。 “YouTubePlayerSupportFragment无法解析”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Android Studio IDE中的应用程序中开发的YouTube功能。这是我的$ C $目前C:

I am trying to develop youtube functionality within an application using the Android Studio IDE. This is my code currently:

-

的问题是周围的进口。现在,我在正确的位置(我相信)导入的JAR文件:

The issue is surrounding the imports. Now, I have the JAR file imported in the correct spot (I believe):

的,我也把它添加到build.gradle文件奉命:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.apis:google-api-services-youtube:v3-rev125-1.19.1'
}

我也证实,它是在正确的项目结构:

AND I also, confirmed it is in the right project structure:

我已经看过这个计算器,但有没有帮助有:<一href="http://stackoverflow.com/questions/22898390/youtubeplayersupportfragment-cannot-be-resolved-to-a-type">YouTubePlayerSupportFragment不能被解析为一个类型

I have already looked at this stackoverflow, but there was no help there: YouTubePlayerSupportFragment cannot be resolved to a type

我已经'清理'的应用程序,关闭和打开Android的工作室,并重新启动电脑,但我完全没了主意,为什么这是不承认的进口。谁能帮我明白我需要做的,让这些进口的正常工作?

I have already 'cleaned' the app, closed and opened Android Studio, and rebooted the computer, but I am completely out of ideas as to why this is not recognizing the imports. Can anyone help me understand what I need to do to allow these imports to function correctly?

感谢你在前进!

-sil

推荐答案

出色,得到它固定的,虽然它是由于试错。基本上,我们不得不强制摇篮同步(即使在左上角是根本不行的同步按钮,也没有重新启动)。

Well, got it fixed, though it was due to trial and error. Basically, we had to force a gradle sync (even though the sync button in the top left did nothing, nor did rebooting).

下面是我采取的步骤:

首先,我走进了build.gradle文件(错了,一个是项目,而不是模块)

First, I went into the build.gradle file (the WRONG one, the one that is for the project, not the module)

我添加了一个编译语句有,即使下面的评论说不能这样做,并点击立即同步。

I added a compile statement there even though the comment below says not to do so, and clicked sync now.

然后,一个错误窗口弹出:

Then, an error window popped up:

我没有点击其中任何一个。我又回到build.gradle文件:

Which I did NOT click either of them. I went back into the build.gradle file:

删除了code我写的,然后点击重试。

Deleted the code I had written and then clicked try again.

在此之后,它神奇地修复自己。

After that, it magically fixed itself.

不知道为什么它修好它或它为什么在第一时间没有工作,但如果有谁遇到同样的,试试这个,看看它是否会有所帮助。

No clue why it fixed it or why it did not work in the first place, but if anyone ever comes across the same, try this and see if it helps.

-sil

这篇关于问题与Android工作室的Youtube进口。 “YouTubePlayerSupportFragment无法解析”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆