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.
apply plugin: 'com.google.gms.google-services'
at the bottom of yourapp/build.gradle
, as documented here? – Burgonet