error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) code example
Example: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
Set your compileSdkVersion to 29 or higher. The buildToolsVersion (if you still have that) does not have an impact on the Android SDK symbols — that is determined by your compileSdkVersion.