3

I have recently downloaded Android Studio, I thought it has more features than eclipse.

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(); }

1
  • Possibly similar issue is here Commented Dec 27, 2014 at 15:22

2 Answers 2

8

It is a duplicate of Unable to build PlusClient and can not find symbol class Builder

For Quick Reference: The issue is that the PlayClient is deprecated now but the template still uses the old way.

Thus, you can:

  1. Change the play services version in the gradle dependencies (build.gradle) from com.google.android.gms:play-services:6.5.87 to com.google.android.gms:play-services:6.1.71.

OR

  1. 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 of GoogleApiClient.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(); 
Sign up to request clarification or add additional context in comments.

Comments

-1

I think you didn't download the Google Play services yet, if so then download them from SDK Manager -> Extras -> Google Play Services.

And if they are already downloaded then you should do

step 5 of Google+ Quickstart:

  1. Import the Google Play Services library project.

Select File > Import > Android > Existing Android Code Into Workspace and click Next. Select Browse.... Enter /extras/google/google_play_services/. Select google-play-services_lib. Click Finish to import.

Hope it will help you.

1 Comment

When we use templates in Android studio they add play-services as a dependency, and if they don't even then we don't need to import play services. We just need to add compile statement in build.gradle e.g. com.google.android.gms:play-services:6.5.87.Can you please explain your answer?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.