Error in findViewById declaration on Android

Asked

Viewed 406 times

2

I’m new to Android and I’m having a difficult programming. That part of the code always error in R of findViewById. When placing the mouse over the error appears the information Cannot Revolve simble "R", and just give me options to create a variable, class with the name and etc.

@SuppressLint("WrongViewCast")
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cadastro);

        nome = (EditText) findViewById(R.id.edtNome);
        RE = (EditText) findViewById(R.id.edtRE);
        senha = (EditText) findViewById(R.id.edtSenha);

        button4 = (Button) findViewById(R.id.button4);


        button4.setOnClickListener(this);

    }
  • Ja I went through this once and it was an error in the Layout XML in your case can be in activity_registration or other

  • Could you post your xml? By chance you are using Android Studio Canary?

1 answer

3

Probably your build.Radle should not be synchronized so just synchronize, you can also try Build -> Clean Project, or File -> Invalidate Caches / Restart... -> Invalidate and Restart or Rebuild Project.

It’s a boring bug that happens sometimes.

  • It can also give a make project. Most of the time it solves.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.