This question already has an answer here:
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.
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) :
update ADT & SDK , Eclipse and Java
remove gen folder , and create it again .
do a clean-project.
right click the project and choose android-tools -> fix-project-properties .
right click the project and choose properties -> java-build-path -> order-and-export. make sure the order is :
Android 4.3 (always the latest version)
Android private libraries
android dependencies
your library project/s if needed
yourAppProject/gen
yourAppProject/src
make sure all files in the res folder's subfolders have names that are ok : only lowercase letters, digits and underscore ("_") .
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