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

ぐ巨炮叔叔 提交于 2019-11-27 00:30:37
Levi Rizki Saputra

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.

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.

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:

This method worked for me.

Hamza Rahman

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

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.

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.

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.

Morteza Baghalpoor

I just found the solution. Follow the path:

File -> Invalidate Caches / Restart...

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

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!