While adding android platform to your Ionic project if you are getting the following error:
ERR_UNSUPPORTED_API_LEVEL: Unsupported API level: [error] native-run failed with error
The solution is to to install the missing SDK or a lower one from Android Studio.
Go to Android Studio > Preferences > Appearance & Behavior > System Settings > Android SDK
Install the lower APIs like 30/31 and uncheck teh one which is complaining, 32 in this case.
Click Show Package Details check at the bottom to show the sub items of those SDKs.
Check the “Google Play … Intel and ARM” images checkboxes for API Levels to which you are downgrading. API Level 31 in this case.
Wait till the installation of SDKs are done
Running npx cap add android command after that will fix the issue.
npm install @capacitor/android npx cap add android