Reputation: 317
After updating Android Studio, I found some red rows in my project.
What I have.
I call this method:
if (Build.VERSION.SDK_INT < 21) {
orangeProgressBar(progressBar);
}
Using of red ContextCompat.getColor()
:
private void orangeProgressBar(ProgressBar pb) {
int color = ContextCompat.getColor(pb.getContext(), R.color.orange);
...
}
Of course, importing:
implementation 'com.android.support:support-v4:24.2.1'
import android.support.v4.content.ContextCompat;
Studio can't import content.ContextCompat
, because it seems like android.support.v4.content.
have not this child
Upvotes: 1
Views: 4930
Reputation: 769
Deleting the .gradle and .idea did not work for me. What worked was the following:
In Android Studio close all projects
In the Welcome To Android Studio Screen:
Upvotes: 3
Reputation: 734
I had the same problem after updating the Android Studio but the below solution worked for me:
Deleting the .gradle
and .build
folder from your respective project directory structure and rebuild the project.I'm not so sure about what it does but i think it deleted all the previous build caches other build related files and regenerated it that's why it's worked for me.
Upvotes: 2