I got the following error while upload my app to google:
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.
Here is my android/build.gradle
:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
...
}
How can I upgrade app target API to level 31?
4
Answers
I recently had this warning in my google console.
To solve it, I simply updated the
targetSdkVersion
from 30 to 31 inandroid/app/build.gradle
file, which gives the following code (I also had to make sure thecompileSdkVersion
was set to 31):And I had to modify the
buildscript
in theandroid/app
file as below:Add android:exported="true" or android:exported="false" in AndroidManifest.xml
file.
change compileSdkVersion = 31 and compileSdkVersion = 31 in android/gradle/build.gradle [REACT NATIVE APPS]
I also got the same error when I deploy my application on the Play Store
so simply update the
targetSdkVersion = 30
totargetSdkVersion = 31
inYour_project/android/build.gradle
and then run
cd android