Recently, you might have noticed an error while uploading Android moble App build to Google play console that you need to target latest level of APIs optimized for security and performance.
Your app currently targets API level 30 and must target at least API level 31 to ensure it is built on the latest APIs optimized for security and performance. Change your app’s target API level to at least 31.
Solution to this error is very simple and straight forward. Lets fix this issue using the following steps.
Install latest version of API through SDK Manager
Lets click on SDK Manager as mentioned in above screenshot. Clicking on SDK Manager will open up a popup window where we will need to select Appearance & Behavior -> System Settings -> Android SDK. When we select Android SDK from the left menu, we will see a list of SDK platform available to install. Select the ones you need to install and on clicking OK button will install the selected SDK platform.
Now we have our latest SDK installed, lets make the changes to two files to target latest APIs in our mobile APP.
- We need to make changes in Gradle Scripts -> bundle.gridle (Module:android.app)
- Then we need to make changes in manifests -> AndroidManifest.xml
As you can see, we changed compileSdkVersion to 30 and targetSdkVersion to 30. Now we need to sink it. Place your mouse cursor at the end of 30 in compileSdkVersion and press ALT+ENTER in the keyboard. You will see a popup like below.
Now repeat the same steps for targetSdkVersion by placing cursor at the end of 30 and click ALT+ENTER on your keyboard. You will see a popup asking you to update to latest SDK.
We are all done with the build.grade file. Now we need to make one change in second file which is app->manifests->AndroidManifest.xml
Here we need to place mouse cursor at the end of <activity and click ALT+ENTER on our keyboard. This will popup a window asking you to add exported=”true”
Now we are ready to build our App again and upload it to Google Play Store.