I've got an error:
R cannot be resolved to a variable
in line:
setContentView(R.layout.main);
but I can't resolve it doing things that other users wrote should be tried, which are:
- Getting rid of 'import android.R' line.
- Cleaning the project and then building it again.
- Closing project and then opening it again.
- Going to Project Properties > Java Build Path > Tick Android Version Checkbox
- Following the procedure: Uncheck Project->Build Automatically Project->Properties->Builders: Make sure all Android (3) and Java (1) builders are checked (and nothing more) Window->Preferences->Android->Build: Check "Automatically refresh Resources and Assets folder on build" Right-click on project->Android Tools->Fix Project Settings (not sure what it actually does, but it can't hurt)
- Some users advice to check if .xml files are correct. I don't know how I could do that. I must admit I'm new to java and android programming, and I haven't even written a single line in my project - the code has been generated automaticly.
- Layout xml file is named using lower-case letters.
- No error in resource files (no red-crosses).
layout main.xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
Thanks in advance for your help!