Skip to content Skip to sidebar Skip to footer

How Can Resolve R In Android?

I was run the program to guess random number but in case R, their should be 'R cannot be resolved to a variable' error comes many time . And i am also try to import android.R; but

Solution 1:

The R.java file should be automatically generated by Android. Try the following:

  1. If you are using Eclipse try "project clean" to regenerate the file.
  2. Try to fix all errors not related to the R file and then retry the "project clean" option. Other errors (e.g. your xml layout files) can "stall" a new build of the R file via project clean.
  3. Make sure your project is an Android project and you have an android.jar file on your classpath.

Solution 2:

You might not have android minimum SDK version properly configured.

Please check what Android version you have added in your project and what AVD version you have created.

If you have added AVD for API level 7 [Android 2.1] then cross check if it is matching with project.properties file entry as:

target=android-7

Post a Comment for "How Can Resolve R In Android?"