4

I've encountered a weird glitch in Android Studio: Android studio String glitch

As you can see it thinks that it is an error:

'class' or 'interface' expected

But it runs and build just fine, so is this just a visual glitch or can it have any effect during compiling?

I'm running Android Studio 0.5.8 for Mac

Things I've tried so far:

  • Restart Android Studio
  • Restart MacBook
  • Invalidate caches and restart
  • tried other strings (like "en-US" this result in the same effect)

If I use a string through the resources the glitch isn't visible (which it will be eventually, I'm just curious why this is happening)

  • are you 100% that the " from the first string are equals to the ones from the "en" string? I had some copy&paste issues where there was wrong but identically looking symbols where used... – WarrenFaith May 22 '14 at 13:54
  • Yeah I'm sure. Even when I copy&paste the " from the first string to the second string it still shows up – Jasper van de Klundert May 22 '14 at 15:09

3 Answers3

3

IntelliJ and Android Studio have the ability to take string parameters and treat the strings as being in another language. For example, if you have a method that takes a string that's HTML, if you tell the IDE about it, it can give you syntax highlighting and content assist with the HTML in that string.

I think you've inadvertently set this string as being treated as Java, and it's giving you the Java syntax errors on it. You need to un-set that setting. Select the text, bring up the Search Action feature (on Mac it's shift a). In the search box that comes up, search for Un-inject Language/Reference, as shown in the screenshot below:

Screenshot of IDE, showing search for the command to uninject language/reference

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
-1

try this

httpReqquest.addHeader("Accept-Language","en-US");
sai Gorantla
  • 179
  • 9
-1

Since Android Studio is a bit raw, you can face the "glitches" in many different ways. They're annoying but don't affect the result, as you said. However, I personally don't think that we should endure the inconveniences (even if the Studio costs nothing).

I see a couple of solutions:

  1. Continue with AS and ignore these weird things, hoping they will release a robust software once
  2. Or, to migrate to IntelliJ IDEA as I did. The procedure is pricey but it's worth it.