2016-02-28 87 views
0

加上一流的,我下面從谷歌+ API integeration教程從這個谷歌文檔例子https://developers.google.com/+/mobile/android/sign-in一切工作很好,但我只是不能夠從谷歌服務庫找到另外的類。這傢伙Can't resolve com.google.android.gms.plus.Plus class有同樣的問題,但他解決了從sdk更新谷歌服務庫,但它的情況下,它已經更新,但我無法解決它。這裏是將Plus API添加到Google客戶端的代碼無法找到谷歌服務庫

mGoogleApiClient = new GoogleApiClient.Builder(this) 
       .addApi(Plus.API) 
       .addScope(Scopes.PLUS_LOGIN) 
       .addScope(Scopes.PLUS_ME) 
       .build(); 

回答

0

請勿在mGoogleApiClient中添加作用域。將其添加到GoogleSignInOptions對象。試試這個 -

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) 
      .requestProfile() 
      .requestEmail() 
      .requestScopes(new Scope(Scopes.PLUS_LOGIN)) 
      .build(); 

    mGoogleApiClient = new GoogleApiClient.Builder(this) 
      .enableAutoManage(this, this) 
      .addApi(Auth.GOOGLE_SIGN_IN_API, gso) 
      .build(); 

    googleSignIn = (SignInButton) findViewById(R.id.google_sign_in); 
    googleSignIn.setSize(SignInButton.SIZE_WIDE); 
    googleSignIn.setScopes(gso.getScopeArray()); 
相關問題