在实现Google+共享时,我在onCreate中执行以下操作
mGoogleClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();在onClick之后,我在一个按钮上连接谷歌:
mGoogleClient.connect();然后调用回调:
@Override
public void onConnectionFailed(ConnectionResult result) {
// TODO Auto-generated method stub
Log.e("GoogleClient","connection failed!");
Log.e("result",""+ result.getErrorCode());
if (result.hasResolution()) {
try {
result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
} catch (SendIntentException e) {
mGoogleClient.connect();
}
}
// Speichern Sie das Ergebnis und beheben Sie den Verbindungsfehler bei einem Klick des Nutzers.
mGoogleConnectionResult = result;
}我得到了错误代码8,12-28 22:39:56.286: E/result(15533): ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null}。
我将我的APK添加到Google,并获得了一个有效的发布密钥。我知道,因为我第一次尝试分享它就像一种魅力,而且我能够在我的Google+ page上分享。如果我再试一次,什么都不会发生,甚至连Choose Google-account对话框都不会出现。如果我卸载我的应用程序并重新安装它,然后再试一次,当我像第一次获得错误代码Choose Google-account 8 -> 12-28 22:39:56.286: E/result(15533): ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null}时一样,选择我的Google Account时,会出现Google Account对话框。
我得到了最新的Android和最新的Google Play Services。
任何帮助都是非常感谢的。
https://stackoverflow.com/questions/27680810
复制相似问题