Android 我的谷歌&x2B;1按钮灰显且不工作?

Android 我的谷歌&x2B;1按钮灰显且不工作?,android,google-plus,google-play-services,google-plus-one,Android,Google Plus,Google Play Services,Google Plus One,我试图在ma应用程序中集成G+按钮。G+按钮变灰。并且不计数。如何变红 public class HomeActivity extends SherlockActivity implements ConnectionCallbacks, OnConnectionFailedListener{ private static final String URL = "https://play.google.com/store/apps/details?id=com.phoneix

我试图在ma应用程序中集成G+按钮。G+按钮变灰。并且不计数。如何变红

          public class HomeActivity extends SherlockActivity implements ConnectionCallbacks, OnConnectionFailedListener{

private static final String URL = "https://play.google.com/store/apps/details?id=com.phoneix.allu";
private static final int PLUS_ONE_REQUEST_CODE = 0;
private static final int REQUEST_CODE_RESOLVE_ERR = 9000;

private ProgressDialog mConnectionProgressDialog;
private PlusClient mPlusClient;
private ConnectionResult mConnectionResult;
private PlusOneButton mPlusOneStandardButton;

@Override
public void onCreate(Bundle pBundle) {
    super.onCreate(pBundle);
   setContentView(R.layout.dashboard);

    mPlusOneStandardButton = (PlusOneButton) findViewById(R.id.plus_one_standard_button);


    mPlusClient = new PlusClient.Builder(this, this, this)

            .build();


}

@Override
public void onDestroy() {
    if (adView != null) {
        adView.destroy();
    }
    super.onDestroy();
}
@Override
protected void onResume() {
    super.onResume();
    // Refresh the state of the +1 button each time we receive focus.

    mPlusOneStandardButton.initialize(URL, PLUS_ONE_REQUEST_CODE);

}

@Override
public void onDisconnected() {
    // Nothing to do.
}
@Override
public void onConnectionFailed(ConnectionResult result) {
       if (mConnectionProgressDialog.isShowing()) {
               // The user clicked the sign-in button already. Start to resolve
               // connection errors. Wait until onConnected() to dismiss the
               // connection dialog.
               if (result.hasResolution()) {
                       try {
                               result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
                       } catch (SendIntentException e) {
                               mPlusClient.connect();
                       }
               }
       }

       // Save the intent so that we can start an activity when the user clicks
       // the sign-in button.
       mConnectionResult = result;
}

public void onConnected(Bundle connectionHint) {
    mPlusOneStandardButton.initialize(URL, PLUS_ONE_REQUEST_CODE);
}
@Override
protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
    if (requestCode == REQUEST_CODE_RESOLVE_ERR && responseCode == RESULT_OK) {
        mConnectionResult = null;
        mPlusClient.connect();
    }
}
    <com.google.android.gms.common.SignInButton
        android:id="@+id/sign_in_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="92dp" >
    </com.google.android.gms.common.SignInButton>

</RelativeLayout>
}

    <com.google.android.gms.common.SignInButton
        android:id="@+id/sign_in_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="92dp" >
    </com.google.android.gms.common.SignInButton>

</RelativeLayout>
试试这个:

    <com.google.android.gms.common.SignInButton
        android:id="@+id/sign_in_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="92dp" >
    </com.google.android.gms.common.SignInButton>

</RelativeLayout>
在xml文件中:

    <com.google.android.gms.common.SignInButton
        android:id="@+id/sign_in_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="92dp" >
    </com.google.android.gms.common.SignInButton>

</RelativeLayout>

问题在于谷歌play服务的最新更新。 一旦我从应用程序的设置中卸载了google play服务的所有更新,所有+1按钮都会显示良好。
让我们希望谷歌能修复他们的更新。

新的谷歌播放更新改变了plusOne按钮的界面,从而打破了所有基于“旧”谷歌播放服务SDK的plusOne按钮。
    <com.google.android.gms.common.SignInButton
        android:id="@+id/sign_in_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="92dp" >
    </com.google.android.gms.common.SignInButton>

</RelativeLayout>
如果您签出他们的示例,您会发现他们更改了plusOnButton.initialize的接口,它不再接受“plusOneClient”,而是一个URL

    <com.google.android.gms.common.SignInButton
        android:id="@+id/sign_in_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="92dp" >
    </com.google.android.gms.common.SignInButton>

</RelativeLayout>

要修复此问题,请使用您的“Android SDK管理器”下载最新(v13)的Google Play服务,并将其导入到您的项目中。

我的应用程序中也出现了这种情况,我还添加了G+,它昨天和今天本身也变为灰色。我想可能是Google PlayService遇到了问题。@NitinMisra哦,好的,工作时请告诉我,如果我先知道,我会告诉你什么是你的活动。类?我应该登录到我的应用程序吗?这就是你要开始的活动。这里你需要提到你的登录活动。在这方面,你需要为登录到你的应用程序编写逻辑。你的G+按钮是否变为红色,请告诉我?一些应用程序没有登录按钮,它们将获得默认的gmail地址并自动登录。可能吗?欢迎:),你想在打开应用程序时直接使用我们的“按按钮单击”操作进入登录页面吗?更新是什么时候进行的。我三天前正在尝试。我知道他们将客户端更改为builder。。
    <com.google.android.gms.common.SignInButton
        android:id="@+id/sign_in_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="92dp" >
    </com.google.android.gms.common.SignInButton>

</RelativeLayout>