Google+按钮集成……出了点问题

我在Google+按钮集成方面存在此问题。 logcat或强制关闭没有错误,但有些事情是不对的。 我添加了按钮,你可以在下面看到我的XML。 当我离线时它是灰色的,当我在线时它是红白色的,所以我猜这很好。 你也可以告诉我的java代码按钮。 问题是,当我点击它时,它打开一个带有我的谷歌+名称的弹出窗口一秒钟,然后我得到一个错误,你可以在下面的屏幕截图中看到。 我模糊了我的名字。 所以这是屏幕:

在此处输入图像描述

我的XML:

        

我的java代码:

 public class Plusone extends Activity implements ConnectionCallbacks, OnConnectionFailedListener { Intent intent; TextView licznik,title; PendingIntent pintent; int state; 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 mPlusOneMediumButton; int sec; LinearLayout lay2; Handler han2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPlusClient = new PlusClient.Builder(this, this, this) .clearScopes() .build(); setContentView(R.layout.plusone); mPlusOneMediumButton = (PlusOneButton) findViewById(R.id.plus_one_button); state=0; sec=15; licznik=(TextView)findViewById(R.id.textView1); lay2=(LinearLayout)findViewById(R.id.la2); title=(TextView)findViewById(R.id.textView2); if(state==1) { lay2.setVisibility(View.GONE); } else { han2 = new Handler(); han2.post(mUpdate); } mPlusOneMediumButton.initialize(mPlusClient, "https://market.android.com/details?id=us.mypackageame.game",new OnPlusOneClickListener() { @Override public void onPlusOneClick(Intent intent) { // TODO Auto-generated method stub state=1; mPlusOneMediumButton.setVisibility(View.INVISIBLE); title.setVisibility(View.GONE); title.setVisibility(View.GONE); startActivityForResult(intent, PLUS_ONE_REQUEST_CODE); } }); } 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; } @Override public void onDisconnected() { // TODO Auto-generated method stub } @Override protected void onActivityResult(int requestCode, int responseCode, Intent intent) { if (requestCode == REQUEST_CODE_RESOLVE_ERR && responseCode == RESULT_OK) { mConnectionResult = null; mPlusClient.connect(); } } @Override protected void onStart() { super.onStart(); mPlusClient.connect(); } @Override protected void onStop() { super.onStop(); mPlusClient.disconnect(); } private Runnable mUpdate = new Runnable() { public void run() { han2.postDelayed(this, 1000); sec=sec-1; licznik.setText("Or wait: "+ Integer.toString(sec)+" seconds"); if (sec<=0) { han2.removeCallbacks(mUpdate); lay2.setVisibility(View.GONE); startActivity(new Intent("us.mypackageame.game.MENU")); finish(); } } }; @Override public void onConnected() { String accountName = mPlusClient.getAccountName(); // Toast.makeText(this, accountName + " is connected.", Toast.LENGTH_LONG).show(); } } 

该版本的PlusOneButton初始化程序是旧版本 – 尝试确保您使用最新的Google Play服务,并从通话中删除PlusClient – 请参阅http://developer.android.com/reference/com/google/android /gms/plus/PlusOneButton.html

我也不确定这个URL是否能满足您的需求,并且在Play商店中为应用程序+1,我认为它只会+1 URL本身(可能不会在任何地方显示)。