Android Studio Google Play 服务没有自动完成功能 [英] Android Studio Google Play Services no autocomplete
问题描述
我使用 AS 0.4.2 然后按照文档中的描述导入 GMS:https://developer.android.com/google/play-services/setup.html
I use AS 0.4.2 then imported GMS as described in doc: https://developer.android.com/google/play-services/setup.html
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v13:13.0.+'
compile 'com.google.android.gms:play-services:4.0.30' }
IDE 检测到的都是 R 类,但其余代码是不可见的.另一方面,我输入了以下代码:
all what is detected by IDE is R class, but rest of code is invisible. On the other hand I put following code:
import com.google.android.gms.common.GooglePlayServicesUtil;
(...)
private void connectGms(){
Log.d(MbcConstants.TAG,
"check for gms"+ GooglePlayServicesUtil.
isGooglePlayServicesAvailable(this));
}
它可以工作,但 IDE 仍然以红色显示类名,但正确显示了方法的参数和返回类型.
And it works, but IDE still shows class name in red, but properly shows the params and returned type for method.
推荐答案
好的 - 这似乎是 Android Studio 中的一个错误.我所做的修复它:从项目和模块中删除所有依赖项(使用 F4 键)从 projectroot/.idea/libraries 中删除文件
Ok - it seems like a bug in Android studio. What I've done do fix it: remove all dependencies (use F4 key) from project and the module delete files from projectroot/.idea/libraries
打开模块gradle.buld
open the module gradle.buld
重新添加项目运行所需的所有依赖项.就我而言:
add back all dependencies that are needed by your project to work. In my case:
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:19.0.0'
compile 'com.google.android.gms:play-services:4.0.30'
}
再次同步gradle.build
Synchronize gradle.build once again
继续你的爱与恨的冒险或重返日食.
Continue your adventure of love and hate or return to eclipse.
这篇关于Android Studio Google Play 服务没有自动完成功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!