can't figure out missing libraries or imports

So, after reinstalling the SDK and some tools in Android Studio, I keep getting this errors like these:

Error:(5, 19) java: package does not exist
Error:(6, 18) java: package android.os does not exist
Error:(7, 20) java: package android.view does not exist
Error:(8, 22) java: package android.widget does not exist
Error:(11, 35) java: cannot find symbol
  symbol: class Activity

part of the code where the errors lead:

picture of code

I suspect that something has gone missing while messing with the SDK as that part of the code was fine beforehand. project code is not mine, i am still a complete rookie in Java. My apologies if there is a really trivial solution for this, but I've spent hours on googling and trying but can't get it to work.

any ideas what might be causing it?

2 answers

  • answered 2017-11-12 20:34 DigaoParceiro

    Go to File > Invalidate Caches / Restart > Invalidate and Restart

  • answered 2017-11-12 20:34 Krzysztof Kubicki

    Have you checked the location of Android SDK inside Android Studio? You can go to Preferences -> System Settings -> Android SDK and check whether the field "Android SDK Location" is set to the correct path