Android Studio 无法解析导入项目中的 R? [英] Android Studio cannot resolve R in imported project?
问题描述
我正在试用新的 Android Studio.我已经使用 build gradle 选项从 Eclipse 导出了一个项目.然后我将它导入到 Android Studio 中.gen 下的 R.java 文件上有一个带小红圈的 j.在我的源文件中,无论我在哪里引用资源,我都会得到无法解析符号 R",例如R.layout.account_list"等
I'm trying the new Android Studio. I've exported a project from eclipse, using the build gradle option. I've then imported it in Android Studio. The R.java file under gen has a j in a little red circle on it. And in my source files, I get "cannot resolve symbol R" wherever I have a reference to a resource, e.g. "R.layout.account_list" etc.
我以前从未使用过 Intellij.感谢您的帮助,因为显然关于 Android Studio 的答案还不多.谢谢!
I have never used Intellij before. Would appreciate any help as there obviously aren't many answer yet about Android Studio. Thanks!
推荐答案
- 按 F4 进入项目结构,检查左侧的SDK
- 点击Modules ---> Source标签,勾选gen和src作为源
- Press F4 into Project Structure, Check SDKs on left
- Click Modules ---> Source Tab, check gen and src as sources
PS:答案一年多了,菜单也变了.
PS: The answer over a year old and the menus have changed.
这篇关于Android Studio 无法解析导入项目中的 R?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!