Cannot resolve Theme.AppCompat.Light.DarkActionBar

I got complier error on styles.xml says “Cannot resovle Theme.AppCompat.Light.DarkActionBar” and app crash on startup however identical code I dowloaded from BigNerdRanch shows no error and runs fine, Why is that? I’m still comparing them line by line.Anybody can tell me what might gone wrong.By the way I’m using Android Studio 3.1.

OK now I got both app running not crashing(the crashing is some other code error I made) but still the Theme.AppCompat in my app is still labeled red and cannot resolve. I just can’t see why two identical code and lead to different result.

That is strange. Can you check to make sure that you have the AppCompat dependency in your app module’s build.gradle file?

The issue is resolved by close and restart Android Studio for the problem app.I dont understand the machnism behind it maybe some temperay file didn’t load properly the first time

Ok cool. Thank you for following up with your solution.