问题
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