I am new to android, started my programming basics. I am getting error as "R cannot be resolved to a variable" and R.java file is missing even i have cleaned my project and buid it automatically. Please tell me possible answer.And every time it shows the error that R cannot be resolved to a variable. Why it is happening.
My xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
My activity file with the code is shown below.mainAvtivity file:
package com.bis.databasedemo;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.R;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}}
and My Manifest file is here with the following code. look every code and give me possible reply for that as soon as possible:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bis.databasedemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.bis.databasedemo.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
please have a look and tell me reason why such error is coming instead of not any mistake in xml file and even after cleaning project again and again and no any sdk issues also in my eclipse then why still same thing R cannot be resolved to a variable. Thanks in advance.