9

I am using loginActivity in android.

ERROR

can not find symbol class Builder 

I have also imported the file: com.google.android.gms.plus.PlusClient

Error on this line

mPlusClient = new PlusClient.Builder(this, this, this).setScopes(Scopes.PLUS_LOGIN, Scopes.PLUS_ME).build(); 

This is auto generated file from template. What could be the reason for this error?

EDIT

I am using android studio

minSdkVersion 11

targetSdkVersion 21

9
  • you know that if major part of version of library changes it can break the contract? please do not change library to higher version without reading the docs Commented Dec 9, 2014 at 21:41
  • @Selvin : I didn't use any thing. I have just created basic template for loginActivity Commented Dec 9, 2014 at 21:49
  • Could you add to the question from where? Eclipse or android studio and which version of as or adt? The Builder class was there but I don't know in what version of gms and since google not versioning docs of gms is hard to say it Commented Dec 9, 2014 at 21:50
  • @Selvin : I am new to android dev. I don't know how to check adt version Commented Dec 9, 2014 at 21:55
  • Adt is a eclipse plugin, if you are using Android studio then you don't have adt so you shouldn't worry about it. Anyway if is the newest (1.0.0) version of as then template is broken as it not support newest version of gms... You can try to change gms to older version in dependency in gradle file Commented Dec 9, 2014 at 21:58

2 Answers 2

22

I solved in my project by downgrading play-services to:

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

in dependencies in gradle file.

Sign up to request clarification or add additional context in comments.

3 Comments

Worked for me. Weird that the code generated by default LoginActivity would have this problem...
How to change this in eclipse?
And for when you struggle to use the new API because documentation is scarce, this helps: examples.javacodegeeks.com/android/… and androidhive.info/2014/02/…
8

It is not available because it is deprecated. Use GoogleApiClient instead.

Start integrating Google+ : This is the official documentation for implementing Google+ client in your Android app for login and other requirements. Please follow this and not the auto-generated code from Android studio (until the code gets updated with newer implementation).

P.S. The other answer suggests to use older version of PlusClient, which is a wrong approach. You should be using newer code Instead of using older play services.

2 Comments

Would you mind explaining your approach a little bit deeper? The code posted in the answer is automatically generated by Android Studio, so it could be great to provide a better alternative.
Too bad that Android studio hasn't updated the auto-generated code. Google has changed the implementation a while back. I would advise to not use the studio generated code and implement yourself following the documentation. I have updated the answer with the link.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.