How to Solve setsupportactionbar parameter Error

Replace the actionbar with the toolbar in api27. This error is due to the import error when importing the package. You should

import android.widget.Toolbar;

Change to

import androidx.appcompat.widget.Toolbar;

Read More: