Skip to main content

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.

Related articles

Andrew Fletcher16 Aug 2022

How to handle a lost KeyStore password in Android?

If you have a situation where either you have forgotten a Keystore password or change of developers and the password wasn't sent across.... what to do?  However, your app lives on and needs to be updated!   Possible solutions grade.properties This is a great starting point....
Andrew Fletcher08 Aug 2022

How to update package.json dependencies to the latest version?

This article works through the steps to update dependencies in package.json file to the latest version. Use npm-check-updates or npm outdated to suggest the latest versions. npm-check-updates is a utility that automatically adjusts a package.json with the latest version of all...