Cannot resolve symbol ‘AppCompatActivity’

When does this type of error occur?
When you download a new Android Studio or update Android Studio usually the ‘Symbol ‘AppCompatActivity’ issue cannot be resolved, this type of error occurs.
Also, when you import a new project, this type of error is occurring.

Sometimes this type of error occurs because of dependencies in Android Studio.
You can add dependency directly, also add dependency file by clicking on the given link by a mouse hover over error.

When you click on ‘more options’ here you can directly add the dependency.
How to fix the ‘Symbol AppCompatActivity’ error in Android Studio?
Step by step procedure is given for such a solution.
Step: 1
Hover arrow over error.
Step: 2
Now the suggestion box will open.

Here you will see the link ‘add a dependency on androidx.appcompat:appcompat’ or click on more actions.
step: 3
When you click on more options, here you will also see the option Add dependency to androidx.appcompat:app mmpsy:appcompat.

This method automatically detected dependency and downloads the expected files from the internet.
It takes some time to download the required file.

Leave a Reply