36

In Play Store I am trying to upload my app but I'm getting a warning i.e. mentioned below:

Target API level requirements from August 2018

Warning:

Your app currently targets API level 22 and must target at least API level 26 to ensure it is built on the latest APIs optimized for security and performance.

From August 2018, new apps must target at least Android 8.0 (API level 26). From November 2018, app updates must target Android 8.0 (API level 26).

Sadhu
  • 850
  • 2
  • 9
  • 18
  • 1
    ...and? it is not very clear what you are trying to accomplish here – nicecatch May 16 '18 at 10:30
  • https://stackoverflow.com/questions/49140950/failed-to-resolve-com-android-supportappcompat-v7-no-matter-what-i-do/53749951#53749951 you try that solution too if u still needed, i just solved that way – greenridinghood Dec 12 '18 at 19:23

5 Answers5

38

Open build.gradle under android/app/

find the android { } block

Change the following version to the below:

compileSdkVersion 27
buildToolsVersion "27.0.3"
minSdkVersion 16
targetSdkVersion 27

In the dependencies block, change the appcompat line to match the target version

compile "com.android.support:appcompat-v7:27.1.1"
Community
  • 1
  • 1
Albert Gao
  • 3,653
  • 6
  • 40
  • 69
  • 2
    I changed everything 26, but it simply ignores it and carries on with 27... – xeruf Nov 30 '18 at 15:01
  • 4
    How do we find the numbers for the latest `compileSdkVersion`, `buildToolsVersion`, `minSdkVersion` and `targetSdkVersion`. New apps must target API level 28 now, and I don't know where to get the corresponding buildToolsVersion – Sam Apr 05 '20 at 00:48
7

In case your current android/app/build.gradle has lines which look like

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

You will have to edit the android/build.gradle to include

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 21
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    ...
}

Although I do not know where to get the latest versions.

It would be great if someone could edit this to include where to get the latest version numbers

Sam
  • 1,765
  • 11
  • 82
  • 176
4

From August 2021, API level should be 30 or above.

I have React Native app and my android/app/build.gradle looks like below

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

Changed the android/build.gradle to have below content which worked

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "20.1.5948944"
    }
....
Arosha
  • 1,311
  • 2
  • 16
  • 22
1

Just change targetVwersion to 26 in ./android/app/build.gradle

enter image description here

Andrey Patseiko
  • 3,687
  • 1
  • 25
  • 24
0

for the maven part, mentioned by @Bodhish, I needed to do it this way:

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) 
            // is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

with this piece added in addition to @albert's comment resolved for me.

Tracey
  • 96
  • 4