Android Studio,无法解析符号方法

时间:2015-08-07 08:30:35

标签: java android

我一直在关注Google开发者的这个指南,并且偶然发现了一些错误。 https://developers.google.com/identity/sign-in/android/sign-in

以下是我遇到问题的代码:

public void onConnectionFailed(ConnectionResult connectionResult) {
    Log.d("", "onConnectionFailed:" + connectionResult);

    if (!mIsResolving && mShouldResolve) {
        if (connectionResult.hasResolution()) {
            try {
                connectionResult.startResolutionForResult(this, RC_SIGN_IN);
                mIsResolving = true;
            } catch (IntentSender.SendIntentException e) {
                Log.e("", "Could not resolve ConnectionResult.", e);
                mIsResolving = false;
                mGoogleApiClient.connect();
            }
        } else {
            // Could not resolve the connection result, show the user an
            // error dialog.
            showErrorDialog(connectionResult);
        }
    } else {
        // Show the signed-out UI
        showSignedOutUI();
    }
}

和错误:

错误:(133,17)错误:找不到符号方法showErrorDialog(ConnectionResult)

错误:(137,13)错误:找不到符号方法showSignedOutUI()

如果这是一个新手问题我提前道歉,是因为我忘了导入某些内容吗?我尝试过导入许多其他不同的组件,但它没有解决问题。

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.plus.*;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.common.Scopes; 
import com.google.android.gms.common.api.GoogleApiClient;

我是一只迷失的羊在这里,任何帮助我都会非常感激!

3 个答案:

答案 0 :(得分:1)

尝试将其声明为private static final int RC_SIGN_IN = 0;

答案 1 :(得分:0)

显然我必须从谷歌的github这里获得这些方法 - > https://github.com/googlesamples/google-services/tree/master/android/signin 并自己定义它们。

答案 2 :(得分:0)

首先,请不要发布其他信息作为您问题的答案。

辅助,无法解析符号方法始终意味着您的班级或套餐中不存在方法或字段。