An error occurred: the MainActivity class reported red
Cannot access androidx.activity.ComponentActivity
At the beginning, I was still very confused. Why was it okay to create a project before, but why did it become popular this time?
So I started to find the reason: I found that the reason was that the dependent version had been upgraded! feel puzzled
Previous android, appcompat:appcompat:1.0.2 version
Solution: There are two
The first method: In the app of the Module module, find the build.gradle, and add the dependencies that need to be implemented in the dependencies{} structure
implementation "androidx.activity:activity-ktx:1.2.0-beta01"
The second: directly in the dependencies{} structure
implementation androidx.appcompat: increase the number of versions in appcompat
Finally back to normal!