[英]Android Studio not recognizing String
I've encountered a weird glitch in Android Studio: 我在Android Studio中遇到了一个奇怪的故障:
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 我正在运行适用于Mac的Android Studio 0.5.8
Things I've tried so far: 到目前为止我尝试过的事情:
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) 如果我在资源中使用字符串,则毛刺不可见(最终会出现这种情况,我只是好奇为什么会发生这种情况)
IntelliJ and Android Studio have the ability to take string parameters and treat the strings as being in another language. IntelliJ和Android Studio能够获取字符串参数并将字符串视为另一种语言。 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.
例如,如果您有一个采用HTML字符串的方法,如果您告诉IDE它,它可以为您提供语法突出显示和内容辅助,以及该字符串中的HTML。
I think you've inadvertently set this string as being treated as Java, and it's giving you the Java syntax errors on it. 我认为你无意中将这个字符串设置为Java,它会给你带来Java语法错误。 You need to un-set that setting.
您需要取消设置该设置。 Select the text, bring up the Search Action feature (on Mac it's ⌘ shift a ).
选择文本,调出搜索动作功能(在Mac上是⌘ 移 )。 In the search box that comes up, search for Un-inject Language/Reference, as shown in the screenshot below:
在出现的搜索框中,搜索Un-inject Language / Reference,如下面的屏幕截图所示:
试试这个
httpReqquest.addHeader("Accept-Language","en-US");
Since Android Studio is a bit raw, you can face the "glitches" in many different ways. 由于Android Studio有点原始,你可以通过许多不同的方式面对“故障”。 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: 我看到了几个解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.