Andrew Fletcher published: 1 August 2022 1 minute read
Android Studio build errors
Build failed error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)or
cannot find symbol Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
To resolve - upgrade the compileSdkVersion and targetSdkVersion to 31 in your grade file. Note, this setting could be in one of the following files
- android/app/build.gradle
- android/variables.gradle
Also note - Build.VERSION_CODES.R only exists in API 30.
The compileSdkVersion should be set to 30 if you want to use Build.VERSION_CODES.R.
Update for cordova-android@10... As of cordova-android@10, compileSdkVersion has been removed android-targetSdkVersion is unified to set both the target & compile SDK versions so that they always remain consistent.