10

After updating my Android Studio and Java, I get the above error on a simple statement like:

String s = "";

It seems like Android Studio cant find my Java.

I use Gradle (from inside Android Studio) to build my project, on a Windows 7(64bit).

I also get this error:

  @Override, not applicable to method

on my methods using: @Override

You can check out the project on Github, it works on my other computers, but not my home computer.

Can anyone please help me

6
  • Check if android studio can find the JDK ,click settings, project settings I think. Commented Oct 26, 2014 at 14:13
  • Android Studio do find the jdk, it seems more like it finds two, because of the error I get. Commented Oct 27, 2014 at 7:20
  • Point to to the correct Directory, what Operating System are you on ? Commented Oct 27, 2014 at 7:27
  • As mentioned, Windows 7. I have setup environment variables(JAVA_HOME), pointing to the same jdk as in Android studio Commented Oct 27, 2014 at 9:14
  • There is also a project specific jdk setting , try changing that under project settings , I had this issue too Commented Oct 27, 2014 at 11:41

1 Answer 1

14

I know this is old but I got the same problem after my machine crashed while I was using Android Studio. The solution is quite simple, head to

File > Invalidate Caches & Restart

Your IDE will restart and your JAVA environment will be properly functional again.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.