AbAppletic AbAppletic - 4 months ago 189
Android Question

Cannot resolve symbol default_web_client_id in Firebase's Android Codelab

I am trying to learn Firebase, so I went through the Android Codelab. The project they gave me however, had an error:


Cannot resolve symbol default_web_client_id


And I didn't know how to solve it, since I didn't know the value of
default_web_client_id
or what it is. It is in the
onCreate()
method:
SigninActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
mFirebaseAuth = FirebaseAuth.getInstance();

// Assign fields
mSignInButton = (SignInButton) findViewById(R.id.sign_in_button);

// Set click listeners
mSignInButton.setOnClickListener(this);

// Configure Google Sign In
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
}


I have no idea what it is, what's its value is, and why is it giving me this error. I haven't changed anything so far except for adding the
google-services.json
. I have added my SHA-1 and enabled Google in the console.

Answer

Sometimes there is issue while parsing google-services.json. I have reported this issue with to concerned team.

Meanwhile follow below step to fix this issue to get going further -

1) Open google-services.json file -> client -> oauth_client -> client_id

2) Copy this client ID and hardcode this .requestIdToken("your ID")

It would allow to request "IdToken" via GoogleSignInAccount post successful google login and to authorize your credential with firebase.

Comments