Android Studio 将语法标记为错误,但 gradle 会编译 [英] Android Studio Marks syntax as error, but gradle compiles

查看:34
本文介绍了Android Studio 将语法标记为错误,但 gradle 会编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android Studio 中有一个使用 Gradle 编译的项目.一般的文件结构是

I have a project in Android Studio which compiles with Gradle. The general file structure is

MyProject
  - MyProjectSource
  - Libraries
     - ActionBarSherlock

我的项目是用 Gradle 构建的,可以毫无问题地编译.但是,在我的活动中包含 ActionBarSherlock 组件的行中,Android Studio 将其标记为错误.

My project is built with Gradle and will compile without issue. However in the lines within my activity where I include a component from ActionBarSherlock, Android Studio marks it as an error.

我注意到 Android Studio 也生成了 .iml 文件.所以我的问题是:Android Studio 在评估某些语法是否有效时是否会忽略 gradle 构建?

I have noticed that Android Studio has also generated .iml files. So my question: Does Android Studio ignore the gradle build when assessing whether something is valid syntax or not?

显然,这不是项目阻塞问题,但速度很慢,无法利用 Android Studio 必须提供的全套工具.

Obviously this is not a project blocking problem but it does slow velocity not being able to take advantage of the full set of tools Android Studio has to offer.

在此先感谢您的帮助.

推荐答案

这些实际上不是错误,这是 Android studio(0.4.2) 中用于解析符号的错误,并在下一个版本 (0.4.3) 中修复.

These are not errors actually, this a bug in Android studio( 0.4.2 ) for resolving the symbol and fixed for the next release( 0.4.3 ).

要在发布之前摆脱这些,请执行以下操作

To get Rid of these until the release do the following

  1. 使用 Build > 清理你的项目清理项目
  2. 关闭您的 Android Studio
  3. 备份您的项目
  4. 删除项目中的所有 .iml 文件
  5. 删除 .idea 目录的内容
  6. 打开 Studio 并等待它完成与 gradle 的同步

还要验证您是否在 File > 中看到任何错误.项目结构 .如果有任何错误提示未添加依赖项",请单击它并使用右侧的红色灯泡将它们添加到依赖项中.

Also verify if you are seeing any error in File > Project Structure . If there is any error saying "Dependency Not Added "click on that and using red bulb on right side Add them to dependency.

更新

Android Studio 0.4.3 现已在 Canary 频道推出.

Android Studio 0.4.3 is available on Canary Channel Now.

这篇关于Android Studio 将语法标记为错误,但 gradle 会编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆