I am tryng out Android Studio instead of Eclipse. I install it and then start a completely new project and follow the wizard. I add no code of my own.
Then, I right-
I have already had the following dependency in my build.gradle
implementation 'com.android.support:support-v13:26.0.2'
I have tried all of the following,
But, none of them worked for me.
Finally, I solved it by deleting "/.idea/libraries", and then synced with gradle and built again.
Try this may will help you.Go to "File" -> "Invalidate Caches...", and select "Invalidate and Restart" option to fix this.
Android studio has option to manage dependencies. Follow path.
FYI check link stackoverflow.com/a/33414287/1280397
Hrrm... I dont know how many times this has happend so far: I test, try, google, test again and mess around for hours, and when I finally give up, I go to my trusted Stackoverflow and write a detailed and clear question.
When I post the question, switch over to the IDE and boom - error gone.
I can't say why its gone, because I change absolutely nothing in the code except for that I already tried as stated above. But all of a sudden, the compile error is gone!
In the build.gradle, it now says:
dependencies {
compile "com.android.support:appcompat-v7:18.0.+"
}
which initially did not work, the compile errors did not go away. it took like 30 min before the IDE got it, it seems... hmm...
=== EDIT === When I view the build.gradle again, it has now changed and looks like this:
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile "com.android.support:appcompat-v7:18.0.+"
}
Im not really sure what the appcompat is right now.
I was facing the same issue. As it turns out in my build.gradle file there was this :
configurations {
all*.exclude group: 'com.android.support'
}
Removing that fixed my issue. So guys, if doing all that and still your issue is not fixed, look for any exclude keywords in your gradle file.
replace this line of code
import android.support.v4.app.FragmentActivity;
with
import androidx.fragment.app.FragmentActivity;
and you are done.