Android Studio 无法解析导入项目中的 R? [英] Android Studio cannot resolve R in imported project?

查看:32
本文介绍了Android Studio 无法解析导入项目中的 R?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试用新的 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!

推荐答案

  1. 按 F4 进入项目结构,检查左侧的SDK
  2. 点击Modules ---> Source标签,勾选gensrc作为源
  1. Press F4 into Project Structure, Check SDKs on left
  2. 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屋!

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