如何导入R导入Android项目? [英] How to import R into Android project?
问题描述
我已经下载了几个例子的Android项目的学习 ORMLite 。我经常得到这个错误说法研究不能被解析为一个变量
。所以,我只是做了CTRL + SHIFT + O来自动导入所有依赖关系。这然后插入进口android.R;
不幸的是没有解决不了的问题
I've downloaded a couple of example Android projects to learn ORMLite. I constantly get this error saying R cannot be resolved to a variable
. So I just do a CTRL+Shift+O to automatically import all dependencies. This then inserts import android.R;
which unfortunately doesn't solve the problem.
由于包名是 com.test;
我试图做进口com.test.R;
但那也不行。
Since the package name is com.test;
I tried to do import com.test.R;
but that doesn't work either.
有谁知道我可以解决这个问题?
Does anybody know how I can solve this?
推荐答案
尝试下一个步骤(顺序并不重要):
try the next steps (order doesn't matter) :
-
更新ADT和放大器; SDK,Eclipse和Java
update ADT & SDK , Eclipse and Java
删除根文件夹,然后重新创建它。
remove gen folder , and create it again .
做一个干净的项目。
右键单击该项目并选择Android系统工具 - >修复项目 - 属性
right click the project and choose android-tools -> fix-project-properties .
右键单击该项目并选择属性 - > Java的构建路径 - >订单和出口。确认的顺序是:
right click the project and choose properties -> java-build-path -> order-and-export. make sure the order is :
-
的Android 4.3(永远是最新的版本)
Android 4.3 (always the latest version)
Android的私人图书馆
Android private libraries
Android的依赖
android dependencies
库项目/秒,如果需要
yourAppProject / GEN
yourAppProject/gen
yourAppProject / src目录
yourAppProject/src
请确保在资源文件夹的子文件夹中的所有文件的名称是确定:只有小写字母,数字和下划线(_)。
make sure all files in the res folder's subfolders have names that are ok : only lowercase letters, digits and underscore ("_") .
始终确保targetSdk(在清单)中指出,最新的API(目前为18),并设置它在project.properties文件
always make sure the targetSdk (in the manifest) is pointed to the latest API (currently 18) , and also set it in the project.properties file
这篇关于如何导入R导入Android项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!