我正在尝试使用 Android Studio IDE 在应用程序中开发 YouTube 功能。这是我目前的代码:
-
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:
我已经看过这个 stackoverflow,但那里没有帮助:YouTubePlayerSupportFragment 无法解析为类型
我已经“清理”了应用程序,关闭并打开了 Android Studio,然后重新启动了计算机,但我完全不知道为什么这不能识别导入。谁能帮助我了解我需要做什么才能让这些导入正常运行?
先感谢您!
-Sil
好吧,虽然是由于反复试验,但已经修复了。基本上,我们必须强制进行 gradle 同步(即使左上角的同步按钮没有执行任何操作,也没有重新启动)。
以下是我采取的步骤:
First, I went into the build.gradle file (the WRONG one, the one that is for the project, not the module)
我在那里添加了一个编译语句,尽管下面的评论说不要这样做,然后单击“立即同步”。
Then, an error window popped up:
Which I did NOT click either of them. I went back into the build.gradle file:
删除我编写的代码,然后单击重试。
之后,它神奇地自行修复。
不知道为什么它修复了它,或者为什么它一开始就不起作用,但如果有人遇到同样的情况,请尝试这个,看看它是否有帮助。
-Sil
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)