Infinite Loops Infinite Loops - 1 year ago 221
Android Question

Android Studio 2.1 Cannot resolve symbol 'R'

Android Studio 2.1,
Java V8 Update 91, Gradle 2.1.0 .

I know that this questions has been asked many times here, but none of the recommendation solutions works out.

In a sudden after compiling ready to run on Emulator, my IDE give an error at the attribute. Every Java files suddenly give the same error even I don't make any changes to the file.

I tried to make a new project, see if things different but the error keep coming. In my mind it could be internal error, again. Even I just update my IDE just now.

The Java file;

protected void onCreate(Bundle savedInstanceState) {


list_View = (ListView) findViewById(;
String[] Days = new String[] { "Sunday", "Monday", "Tuesday", "Wednesday","Thursday", "Friday", "Saturday"};
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, dayList);

NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);

if (nfc.isEnabled()) {
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, dayList);
Toast.makeText(this, "NFC turned ON", Toast.LENGTH_SHORT).show();

else {
Toast.makeText(this, "Please turn On NFC", Toast.LENGTH_SHORT).show();


is the error.

XML file that associate to the Java;


Is this, again, an internal error?

Answer Source

I try to change the Gradle version from 2.1.0 to 2.0.0, even in AS ver 2.1, ignoring the Instant Run performance and its work out. The little R error is now gone. Now, I tried to change back to 2.1.0, the R error also gone..!! Sometime this little thing drive me crazy, a bit.

Shame on me.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download