No IDEA annotations attached to the JDK 1.8 (C:\...), some issues will not be found

JavaAndroid StudioJava 8Android Studio-3.1

Java Problem Overview


In Android Studio 3.1.2 I am suddenly getting the following message in a yellow tape frame at the top of my editor:

> No IDEA annotations attached to the JDK 1.8 (C:\Program Files\Android\Android Studio\jre), some issues will not be found

I also have a warning in Edit Configurations:

> Default Activity not found

How can I solve these issues?

Java Solutions


Solution 1 - Java

Solution

  • Close Android Studio
  • Go to C:\Users\UserName\.android and rename the build-cache folder to build-cache.bak
  • Go to C:\Users\UserName\.AndroidStudio3.2\system and rename these folders

caches to caches.bak

compile-server to compile-server.bak

compiler to compiler.bak

conversion to conversion.bak

external_build_system to external_build_system.bak

frameworks to frameworks.bak

gradle to gradle.bak

resource_folder_cache to resource_folder_cache.bak

  • Open the Android Studio and open your project again.

Solution 2 - Java

I have been working on 3.2.1 version since October 2018 (for 1 month).
But today I started my project in AndroidStudio with a many errors.

I tried to Invalidate Caches and Restart. But it doesn’t helped me.

So, I opened the folder C:\Users\{username}.
There I found three folders: one for the real version - .AndroidStudio3.2 and two for older versions - .AndroidStudio3.1 and .AndroidStudio2.3.

enter image description here

I could only delete the folder with the actual version, but I deleted all the folders. (Because I have no important user settings in AndroidStudio).

Then I restarted AndroidStudio, and I chose “Do not import settings”. Like this:

enter image description here

This method worked for me.

Solution 3 - Java

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

Solution 4 - Java

I am also stuck with this same issue since last week on 3.2.1 version.

What worked for me is to remove (or you can move it as a backup) the ".AndroidStudio3.2" (for you it will be .AndroidStudio3.1) folder located in "C:\Users{username}" and then reopen the Android Studio.

While launching I selected to import settings from the last version and proceed. it will reconfigure all the settings.

Try that.

Solution 5 - Java

My answer might come late, but here is what fixed the issue for me:

  1. Turn off Android studio

  2. Open C:\Users\UserName\.android and rename the build-cache folder to build-cache.bak

  3. Open C:\Users\UserName.AndroidStudio3.2\system. Rename the files:

  • caches —> caches.bak
  • compiler —> compiler.bak
  • compile-server —> compile-server.bak
  • conversion —> conversion.bak
  • external_build_system —> external_build_system.bak
  • frameworks —> frameworks.bak
  • gradle —> gradle.bak
  • resource_folder_cache —> resource_folder_cache.bak
  1. Restart Android Studio; it will generate those folders again.

  2. After the success, delete the .bak files.

Solution 6 - Java

I just found the solution. Follow the path:

File -> Invalidate Caches / Restart...

Solution 7 - Java

For me, clicking "Attach Annotations" at the top right of the yellow notification bar helped.

This following resource helped as well: https://www.jetbrains.com/help/idea/annotating-source-code.html

But be wary:

> The annotations artifact requires JDK 1.8 or higher. If your project > is compiled using JDK 1.5, 1.6 or 1.7, use the annotations-java5 > artifact instead.

Solution 8 - Java

I'm going to share some information I just discovered about Invalidate Cache / Restart, and I think it's strongly related to the 3.2.1 release. This may explain why it works for some people and why it doesn't work for others. I discovered this problem regarding a different situation, but I think it might be relevant to this problem, so it may be worthwhile giving it a try.

There are times when the Invalidate Cache / Restart won't clear the cache for an opened project. I'm not sure what gets you into that state, but that happened to me. What I did to correct the problem was to rename the project directory name, open Android Studio with the new renamed name, then run Invalidate Cache / Restart. I then closed the project, renamed the project directory name back to it's original name and then opened Android Studio using the original name and that fixed my problem.

In my situation, the problem I was having was that Android Studio was improperly displaying the contents of a file, but when I examined the file using an external viewer, the file actually had the correct content. So, my guess was that, Invalidate Cache / Restart would fix the problem. But it didn't work until I did the little trick I mentioned above. So that's why I sharing my discovery, since it might explain why Invalidate Cache / Restart works for some people and not others. Again, I don't yet have a clue on how a project gets into the state where it where it won't Invalidate Cache for an open project. Possible and file lock issue, or some background executor task responsible for clearing the cache for the opened project doesn't get run before Android Studio restarts.


Update: I actually had the exact same problem occur in one of my projects. Invalidate Cache / Restart did not work until I need my little trick of renaming the project, opening it, Invalidate Cache / Restart, close project, rename project back to original name, an opening it. The message No IDEA annotations attached to the JDK 1.8 was then gone.

One of the things I tried that didn't work, was to close the project that had the problem and run Invalidate Cache / Restart from a different project. So it's not quite accurate to say the Invalidate Cache / Restart sometimes doesn't work for opened projects. I have reported the problem to the android group through the "Submit Feedback" channel. They should be able to figure out what the internal code issue is. It would be useful to find my post to that team and add that you're experiencing the same problem.

Solution 9 - Java

For windows: Remove caches folder from C:\Users\username\ .AndroidStudio3.3\system and re import project worked for me.

Check for your current android studio version and you can remove caches folder in that.

Solution 10 - Java

Both errors mentioned in the question also showed up on my computer. This worked for me:

  • Remove and re-install Android Studio
  • During the installation, when asked to keep Android Studio settings, do not keep the settings
  • Do not open your project from disk; re-import your project from Version Control System, for example GitHub.

Solution 11 - Java

The following steps resolved the error for me,

Step 1: Search everywhere (shift + shift), then type "Setup JDK" as search text

enter image description here

Step 2 : Select something from the list (I selected the highlighted one),

enter image description here

That's it, you shouldn't be seeing the error now.

Solution 12 - Java

The new Android Studio update is available, version 3.3 and that solved my problem. Happy coding.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMorteza BaghalpoorView Question on Stackoverflow
Solution 1 - JavaLevi Rizki SaputraView Answer on Stackoverflow
Solution 2 - JavaV.MarchView Answer on Stackoverflow
Solution 3 - JavaHamza RahmanView Answer on Stackoverflow
Solution 4 - JavaSeekerView Answer on Stackoverflow
Solution 5 - JavaTakiView Answer on Stackoverflow
Solution 6 - JavaMorteza BaghalpoorView Answer on Stackoverflow
Solution 7 - JavaJoe FlackView Answer on Stackoverflow
Solution 8 - JavaTom RutchikView Answer on Stackoverflow
Solution 9 - JavaNikView Answer on Stackoverflow
Solution 10 - Javaʕ ᵔᴥᵔ ʔView Answer on Stackoverflow
Solution 11 - JavaNarshimView Answer on Stackoverflow
Solution 12 - JavaHlompho MohapiView Answer on Stackoverflow