Can't resolve com.google.android.gms.plus.Plus class

只谈情不闲聊 提交于 2020-01-13 09:05:13

问题


I can't seem to resolve the Plus class from the Google Play services library. I've already imported the Google Play library into the project as an Android Library project through Eclipse. I'm also following the basic example from the getting started page.

My onCreate is currently this:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .addApi(Plus.API, null)
    .addScope(Plus.SCOPE_PLUS_LOGIN)
    .build();
}

Eclipse flags the Plus class names because it can't resolve them so the code doesn't build.


回答1:


Thank you NickT. I just updated Google Play Services and the Plus class came with the library.




回答2:


This might sort out the issue

mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(Plus.SCOPE_PLUS_LOGIN) .build();




回答3:


Have you set the meta-data in the manifest?

The all steps indicated in the getting started guide should be everything you need.




回答4:


Add this in your app/build.gradle:

compile 'com.google.android.gms:play-services:8.1.0'



来源:https://stackoverflow.com/questions/21790651/cant-resolve-com-google-android-gms-plus-plus-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!