NoOptions 无法解析为类型

Posted

技术标签:

【中文标题】NoOptions 无法解析为类型【英文标题】:NoOptions cannot be resolved to a type 【发布时间】:2014-07-23 21:06:54 【问题描述】:

我正在尝试在我的游戏中加入 google play 服务。

我已经导入 BaseGameUtils 项目,当我将他添加到我的工作区时,eclipse 说:

 "NoOptions cannot be resolved to a type" 

还有:

 "The import com.google.android.gms.common.api.Api.ApiOptions cannot be resolved"

它发生在 GameHelper 类中。

这是唯一无法解决的问题。 有人对此有解决方案吗? 我已经尝试了所有方法,但我无法找到一些解决方案。

对不起,我的英语不好。

【问题讨论】:

我看到你已经导入了 BaseGameUtils 项目,但是你导入了 GooglePlayServices 项目吗? 是的,我还在 BaseGameUtils 中创建了它的引用。 您使用的是最新的 BaseGameUtils 和 GooglePlayServices 吗? BaseGameUtils:github.com/playgameservices/android-samples/tree/master/… 我再次从您的链接下载了 BaseGameUtils,导入它,但仍然无法解析 NoOptions。我怎么知道我是否使用了最新的 GooglePlayServices? 转到 Google Play 服务项目的清单。我使用 versionName 4.3.23,一切正常。好像有一个 4.4 刚刚在 5 月发布的:developer.android.com/google/play-services/index.html 【参考方案1】:

在 build.gradle 中,确保你的依赖项中有这个

dependencies
    
        compile "com.google.android.gms:play-services:5.0.+"
    

【讨论】:

以上是关于NoOptions 无法解析为类型的主要内容,如果未能解决你的问题,请参考以下文章

toast 无法解析,activitynotfoundexception 无法解析为类型

无法解析为类型(jsp + eclipse)

Cucumber 无法解析为类型

EnableConfigServer 无法解析为类型

EnableWebSecurity 无法解析为类型

SpringBootTest 无法解析为类型