【问题标题】:Internal error occur when integrating google plus整合google plus时出现内部错误
【发布时间】:2016-03-23 04:26:03
【问题描述】:

我正在开发一个 Google+ 集成应用程序。我参考了 Google+ 官方教程。我的问题是当我当时按下登录按钮时,它显示一个 toast 消息错误“发生内部错误”。我不知道为什么会出现这个错误,我看到以下链接但没有得到任何输出....

First Link

Second Link

Third Link

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;
import com.example.bluetoothsocialsharing.R;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.plus.PlusClient;
public class GooglePlusActivity extends Activity implements ConnectionCallbacks, OnConnectionFailedListener
{

    //static final String[] SCOPES = new String[] { Scopes.PLUS_PROFILE };

    @Override
    protected void onStop() {
        super.onStop();
        mPlusClient.disconnect();
    }
    /*@Override
    protected void onDestroy() {
        super.onDestroy();
        mPlusClient.disconnect();
    }*/
    @Override
    protected void onStart() {
        super.onStart();
        mPlusClient.connect();
    }
        private static final String TAG = "ExampleActivity";
        private static final int REQUEST_CODE_RESOLVE_ERR = 9000;
        private ProgressDialog mConnectionProgressDialog;
        private PlusClient mPlusClient;
        private ConnectionResult mConnectionResult;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_google_plus);
        mPlusClient = new PlusClient.Builder(this, this, this)
        .setVisibleActivities("http://schemas.google.com/AddActivity","http://schemas.google.com/BuyActivity")
        .build();
        //mPlusClient=new PlusClient(this,this,this,SCOPES);
        // Progress bar to be displayed if the connection failure is not resolved.
        mConnectionProgressDialog = new ProgressDialog(this);
        mConnectionProgressDialog.setMessage("Signing in...");
        mConnectionProgressDialog.show();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.google_plus, menu);
        return true;
    }

    @Override
    public void onConnectionFailed(ConnectionResult result) {
        Log.i(TAG,"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 {
                Log.i(TAG,"EnterTryBlock");
                   result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
           } catch (SendIntentException e) {
               Log.i(TAG,"EnterCatchBlock");
                   mPlusClient.connect();
           }
        }
      }
      // Save the result and resolve the connection failure upon a user click.
      setmConnectionResult(result);
    }

    @Override
    protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
        if (requestCode == REQUEST_CODE_RESOLVE_ERR && responseCode == RESULT_OK) {
            setmConnectionResult(null);
            mPlusClient.connect();
        }
    }

    @Override
    public void onConnected(Bundle connectionHint) {
        String accountName = mPlusClient.getAccountName();
        Toast.makeText(this, accountName + " is connected.", Toast.LENGTH_LONG).show();
    }
    @Override
    public void onDisconnected() {
        Log.d(TAG, "disconnected");
    }

    public ConnectionResult getmConnectionResult() {
        return mConnectionResult;
    }

    public void setmConnectionResult(ConnectionResult mConnectionResult) {
        this.mConnectionResult = mConnectionResult;
    }
}

【问题讨论】:

  • 您需要提供更多信息,例如显示的任何 Logcat 错误。
  • no logcat 错误自动显示“内部错误”toast 消息..
  • 你解决了吗?我也面临同样的问题。
  • 不,伙计,如果你解决了,请告诉我
  • @Satheesh 找到任何解决方案?

标签: android google-plus


【解决方案1】:

萨西斯,

重启你的 Eclipse 后,一旦去删除那个文件 .android/debug.keystore。 窗口 -> 首选项 -> Android -> SHA1 指纹 键上有新的密钥,你只需复制它并在你的控制台页面中添加新项目,然后粘贴你的新密钥和包名称。在尝试了它的工作之后......

【讨论】:

  • 您是否在两台不同的机器上测试同一个应用程序?
  • ya Ojonugwa Ochalifu 我已经对其工作进行了测试。我遇到了与内部错误相同的错误。我更改了 sha1 密钥和开发人员控制台页面创建新项目并输入项目名称和 sha1 密钥以启用深度链接。它工作正常。
  • 这就是我要你做的,SHA1 密钥只适用于一台机器。
  • 哦,你只工作一台机器。如果您想要另一台机器,请创建另一个客户端 ID。
  • 如果你已经在你的谷歌开发者控制台中设置了你的 SHA1 指纹(调试或发布)并且你仍然有这个问题,检查你是否使用你的密钥有效地构建,这里是设置密钥的方法在 Android Studio 中:stackoverflow.com/a/17992232/2486332
【解决方案2】:

我遇到了同样的问题。在指南中它说

mPlusClient = new PlusClient.Builder(this, this, this)
                .setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity")
                .setScopes("PLUS_LOGIN")  // Space separated list of scopes
                .build();

我把它改成了这个,它工作了

mPlusClient = new PlusClient.Builder(this, this, this)
                .setActions("http://schemas.google.com/AddActivity",
                        "http://schemas.google.com/BuyActivity")
                .build();

如果您使用 Eclipse 测试应用程序,请确保在 Window -> Preferences -> Android -> Build in your Google + console 中使用 SHA1 指纹

【讨论】:

  • 不,我在分配两个代码时遇到了同样的错误。请分享您的完整代码...谢谢...
【解决方案3】:

我解决了我的问题。 使用密码 android 重新创建一个 sha1 密钥。现在这对我来说很好。所以问题在于创建 sha1 密钥。

【讨论】:

    【解决方案4】:

    这是其中一种情况,它可以帮助我正常运行我的应用程序

    "An internal error occurred" with integration of Google Plus Login

    所以,这个答案说你应该在谷歌开发者控制台中填写左侧菜单的“同意屏幕”,你在哪里注册你的应用程序。

    如下所示:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多