why does this onclicklistener not work in android studio? : i created this click listener in a android project, it is taken from a tutorial.It worked there but does not seem to work when I tried it in my new app.

     ImageView animals = (ImageView) findViewById(R.id.anim);

        animals.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
               
                Intent animalsIntent = new Intent(MainActivity.this, animals.class);

                // Start the new activity
                startActivity(animalsIntent);
            }
        });

the app crashes when i do this