Try deleting and reinstalling the SDK platforms. Delete the folders in ~\Android\Sdk\platforms and download the SDKs you need.
Edit: The above somehow resolved the issue before, but I ran into the same problem again when more external packages were updated. This time, deleting the SDK platforms didn’t work. Instead, I updated Gradle in two locations in my project:
android/build.gradle
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1' // Update this line
...
}
}
Note: 7.2.1 for the Android Gradle Plugin is the latest stable release present at this time in Google’s Maven repository. To check for newer versions, visit https://maven.google.com, or the release notes. Under com.android.tools.build > gradle you will find the versions available for Android.
android/gradle/wrapper/gradle-wrapper.properties
...
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip # Update this line
Updating the plugin in these two spots resolved the issue for me this time.