skip to Main Content

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


  1. buildscript {
        ext {
            buildToolsVersion = "31.0.0"
            minSdkVersion = 21
            compileSdkVersion = 31
            targetSdkVersion = 31
            ndkVersion = "20.1.5948944"
        }
        ...
    }
    
    Login or Signup to reply.
  2.   <activity
        android:name=".MainActivity"
        android:exported="true" ... >
    

    Add android:exported="true" or android:exported="false" in AndroidManifest.xml
    file.

    buildscript {
        ext {
            buildToolsVersion = "31.0.0"
            minSdkVersion = 21
            compileSdkVersion = 31
            targetSdkVersion = 31
            ndkVersion = "20.1.5948944"
        }
        ...
    }

    change compileSdkVersion = 31 and compileSdkVersion = 31 in android/gradle/build.gradle [REACT NATIVE APPS]

    Login or Signup to reply.
  3. I also got the same error when I deploy my application on the Play Store

    so simply update the targetSdkVersion = 30 to targetSdkVersion = 31 in Your_project/android/build.gradle

    targetSdkVersion = 31
    

    and then run

    cd android

    ./gradlew clean
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search