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 Fletcher31 Oct 2023
Android icon not changing
If the Android app icon is not changing from the default icon (in my situation this was the Capacitor icon), here are some steps to troubleshoot and resolve the issue: Check the Icon FilesEnsure that you have provided the correct icon files in the appropriate directory. In a Capacitor project,...