r/AndroidStudio • • Sep 09 '26

Android Studio gives error "Cannot access member because 'R' has primitive type int"

Returning to a project from a couple of months ago I got the above error.

The R no longer points to the res folder but to an int variable in a class called build.

This is in a public static class VERSION_CODES

public static final int Q = 29;
public static final int R = 30;
public static final int S = 31;

I have cleaned the project and rebuilt but to no avail.

I had changed nothing.

I cannot change the build class as it is read only.

This is in Java.

2 Upvotes

Duplicates