Android Studio is complaining with Cannot access androidx.activity.ComponentActivity
in redline, but it's compiling and running fine. I came across many SO posts like this and all suggests clearing cache, removing .idea
and .gradle
files, clean project. I've tried everything and I still keep getting this. Am I missing something?
Asked
Active
Viewed 4,323 times
10

Arun Kumar Nagarajan
- 2,347
- 3
- 17
- 28
-
Which parent `Activity` class you're inheriting from? also share your version if it's `androidx.appcompat`. – Jeel Vankhede Dec 13 '19 at 14:55
-
I'm extending from AppCompatActivity – Arun Kumar Nagarajan Dec 14 '19 at 17:22
-
3Have you solved it? – Artem Oct 27 '20 at 20:33
3 Answers
1
for me downgrading appcompat version to 1.4.2 fixed the problem
you should add this to your build.gradle
implementation 'androidx.appcompat:appcompat:1.4.2'

Amin
- 73
- 8
0
check the package of AppCompatActivity
.
In my situation, the Activity
extends RxAppCompatActivity
from the rxlifecycle
library.
But the parent class of RxAppCompatActivity
in rxlifecycle2
is android.support.v7.app.AppCompatActivity
.
I change to the 'rxlifecycle3' and the problem is soloved.

tesla1984
- 541
- 2
- 8