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

12

72

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?

Arad answered 7/6, 2018 at 11:38 Comment(0)
G
179

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.

Grith answered 7/10, 2018 at 10:10 Comment(4)
this also worked for android:xxxx unknown attribute error warning in layout file.Sarcastic
It helps me a lot,thanks.I think this solve can work because some of these file was broken.When we rename the folder,AS will make a new folder(or download?not sure)Criner
This method actually renames that files so that Android Studio doesn't recognize it. This method is actually same as deleting that files. I renamed that files only to backup if an error occurred in Android Studio. So, you can solve the problem by deleting that files.Grith
Thank you, do you know what caused it?Dispersant
A
22

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.

Airiness answered 21/11, 2018 at 11:48 Comment(1)
just remove the system folder from the current version and replace it with old version worked for meJarred
B
13

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

Bathrobe answered 26/8, 2018 at 4:38 Comment(0)
C
5

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.

Crave answered 16/10, 2018 at 7:14 Comment(0)
A
4

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
  4. Restart Android Studio; it will generate those folders again.

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

Aberdeen answered 19/10, 2019 at 14:56 Comment(2)
Can you please add some more information in case the link is not working?Blackburn
I have edited my answer and provided the steps i followed to solve my issueAberdeen
A
3

I just found the solution. Follow the path:

File -> Invalidate Caches / Restart...
Arad answered 7/6, 2018 at 12:25 Comment(0)
D
3

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.

Disordered answered 1/8, 2018 at 19:11 Comment(0)
L
3

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.

Lemuellemuela answered 19/10, 2018 at 0:9 Comment(4)
New update: It originally looked like the technique I described fixed the problem, but when I visited the project again this morning, the error message "No IDEA annotations attached to the JDK 1.8" has come back. I'm at a lost being able to explain what I observed. What I'm also seeing is that projects that didn't have this error message are all suddenly having this same error message.Lemuellemuela
My last update: Levi Ricki Saptra solution seems to have solved the problem. His solution looks like to me to be a manual way to force all of cache to be cleared for all projects. You would think that Invalidate Cache / Restart would have been the equivalent of his solution, but that doesn't appear to be the case. Good job Levi!Lemuellemuela
when you say 'improperly displaying the contents of a file', by any chance, do you .java files look like XML files w/ totally different content ? This stumped me for weeks. I usually import my project from github and start over, VERY annoying and it keeps happeningRoswell
Yeah, that's exactly what I saw!Lemuellemuela
K
3

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.

Kelbee answered 26/4, 2019 at 10:40 Comment(0)
C
0

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.
Catechetical answered 15/10, 2018 at 13:57 Comment(0)
N
0

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.

Naturalism answered 12/11, 2019 at 17:18 Comment(0)
A
-2

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

Aguascalientes answered 22/1, 2019 at 2:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.