0

From 2 days, when I open Android Studio project, it seems like JDK is not defined, like on picture. When I place mouse cursor on some red method and click alt + enter, I can setup JDK, but when I make it, it does not help at all. Even Gradle refresh gives nothing.

I can temporarily fix this by going to "Invalidate caches/Restart...", but then upon the next restart I see the same problem.

Android Studio Version: 2.3.3

enter image description here

Edit Settings of sdk

cerbin
  • 1,180
  • 15
  • 31
  • Are you saying the problem is solved if the "Invalidate Caches / Restart ..." menu item is selected? And then the problem occurs again after some amount of time? –  Sep 15 '17 at 19:57
  • Show the version of Android Studio in the body of the question, too. –  Sep 15 '17 at 19:59
  • Related: https://stackoverflow.com/q/35578036/1531971 –  Sep 15 '17 at 19:59
  • @jdv If I restart Studio with File -> Invalidate Caches / Restart. Problem occurs when I close and then reopen Studio. – cerbin Sep 15 '17 at 20:02
  • The assumption here is that you have **not** set any custom SDKs in File > Project Structure ... > SDK Location. Is this true? Are you using the "embedded JDK" as per those settings? –  Sep 15 '17 at 20:17
  • This looks like something environmental. You may be forced to reinstall Android Studio from scratch, and make sure it is using the embedded JDK (unless you need to use a custom JDK location for some reason.) –  Sep 15 '17 at 20:33
  • @jdv If that would help, file misc.xml is changing my language lvl from JDK_1_7 to JDK_1_8, even if it is in gitignore. – cerbin Sep 15 '17 at 20:36
  • What is D: drive? This is where the "caches" that AS uses will be stored. Maybe this volume is failing somehow? –  Sep 15 '17 at 20:36
  • @jdv It is my HDD Drive with data and programs, I have installed sdk there. – cerbin Sep 15 '17 at 20:37
  • JDK language version: this is controlled in build.gradle, in the compileOptions{} closure. gitignore won't keep AS from updating misc.xml. It just won't add it to any commits. In a team setting you actually want this file shared in version control. –  Sep 15 '17 at 20:39
  • I think this is very environmental. Something is interfering with the caches on the D: drive. Either the drive is failing, or something like realtime antivirus is causing a problem. Or if it is a removable drive, it might not have the right permissions. At any rate, I think this is a system problem of some sort. –  Sep 15 '17 at 20:43

0 Answers0