问题描述
我最近下载了 Android Studio
,我认为它有比 eclipse
更多的功能。
I have recently downloaded Android Studio
, I thought it has more features than eclipse
.
我创建了一个新项目,其中包含登录活动,但似乎活动出现错误:![在此处输入图像说明] [1]
I created a new project, with a log in activity, but it seems there is an error with the activity :![enter image description here][1]
**Error:(78, 31) error: cannot find symbol class Builder
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.**
import com.google.android.gms.plus.PlusClient;
// This is the helper object that connects to Google Play Services.
private PlusClient mPlusClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialize the PlusClient connection.
// Scopes indicate the information about the user your application will be able to access.
mPlusClient =
new PlusClient.Builder(this, this, this).setScopes(Scopes.PLUS_LOGIN,
Scopes.PLUS_ME).build();
}
推荐答案
这是和
快速参考:
问题是现在不推荐使用PlayClient,但模板仍采用旧方法。
For Quick Reference:The issue is that the PlayClient is deprecated now but the template still uses the old way.
因此,您可以:
- 更改gradle中的播放服务版本依赖项(
build.gradle
)从com.google.android.gms:play-services:6.5.87
到com.google.android.gms:play-services:6.1.71
。
- Change the play services version in the gradle dependencies (
build.gradle
) fromcom.google.android.gms:play-services:6.5.87
tocom.google.android.gms:play-services:6.1.71
.
OR
-
使用此处所述的新方式:即,而不是创建
PlusClient.Builder
的实例创建一个GoogleApiClient.Builder
的实例,如下所示:
Use the new way as described here:http://android-developers.blogspot.in/2014/02/new-client-api-model-in-google-play.html i.e, instead of creating the instance of
PlusClient.Builder
create an instance ofGoogleApiClient.Builder
as shown:
// Builds single client object that connects to Drive and Google+
import com.google.android.gms.common.api.GoogleApiClient;
mClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addApi(Plus.API, plusOptions)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
这篇关于找不到符号类“构建器”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!