Andrea R.
Andrea R.

Reputation: 33

Android cannot resolve symbol auth_failed

I just started coding a new app using Firebase. The issue is that are missing the symbol from error like: auth_failed, minimum_password. I tried rebuilding the project, creating a complete new app, but still missing.

How can i fix this?

public class MainActivity extends AppCompatActivity {

private static final String TAG = "MainActivity";

private EditText etInputEmail;
private EditText etInputPassword;
private Button btnRegister;

private FirebaseAuth mAuth;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    etInputEmail = (EditText) findViewById(R.id.etInputEmail);
    etInputPassword = (EditText) findViewById(R.id.etInputPassword);
    btnRegister = (Button) findViewById(R.id.btnRegister);

    mAuth = FirebaseAuth.getInstance();

    btnRegister.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String email = etInputEmail.getText().toString().trim();
            String password = etInputPassword.getText().toString().trim();

            mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "createUserWithEmail:onComplete:" + task.isSuccessful());

                    if (!task.isSuccessful()) {
                        Toast.makeText(MainActivity.this, R.string.auth_failed, Toast.LENGTH_SHORT).show();
                    }
                }
            });
        }
    });

}

Upvotes: 0

Views: 913

Answers (1)

Andrea R.
Andrea R.

Reputation: 33

Just define the auth_failed string in your strings.xml file.... If you look at the strings.xml in the sample where this code was taken, you can see it defined there: https://github.com/firebase/quickstartandroid/blob/master/auth/app/src/main/res/values/strings.xml

Upvotes: 1

Related Questions