Home > Enterprise >  Cannot resolve symbol R.drawable.abc_ic_ab_back_material
Cannot resolve symbol R.drawable.abc_ic_ab_back_material

Time:06-02

My code sample -

final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
    upArrow.setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
    getSupportActionBar().setHomeAsUpIndicator(upArrow);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v){
            finish();
        }
    });

It was working fine. But today I open the project and it is showing " Cannot resolve symbol 'abc_ic_ab_back_material' "

CodePudding user response:

Rebuilding your project might fix the problem, if not Make sure that you have imported the correct R class, it should be like

import <YourPackage>.R;

if it is correct, then make sure you have the drawable inside your drawable folder. If so then try File -> Invalidate Cache -> Invalidate and Restart

CodePudding user response:

Try sync, this could happen when your R file is not imported correctly.

  • Related