React-native: React Native Android needs to target API level 29 before November 2, 2020

Created on 27 Jul 2020  路  19Comments  路  Source: facebook/react-native

Description

As per the new Google Play policy, all apps must target at least Android 10 (API 29) before November 2, 2020.

More info: https://developer.android.com/distribute/play-policies

React Native is targeting API 28 as of today(v0.63), are there any plans to update the target SDK version?

React Native version:

v0.63

Expected Results

React Native to target API 29 well before November 2020, so that all apps using React Native can adapt to it.

Attention Android

Most helpful comment

Yup, you can just update it yourself while the upstream is updated. After making the change, run a gradle sync in Android Studio after doing the update to double check that everything went well.

android {
    defaultConfig {
        ...
-       targetSdkVersion 28
+       targetSdkVersion 29
        ...
    }
}

What about other properties, should they also be updated to 29 ?

      { 
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 29
        supportLibVersion = "28.0.0"
    }

All 19 comments

I agree that it needs to be updated upstream, but I'm fairly sure you can update the API target and the build tool versions yourself. I've done it before on previous versions where my app had a higher API target and it worked just fine in production

Yup, you can just update it yourself while the upstream is updated. After making the change, run a gradle sync in Android Studio after doing the update to double check that everything went well.

android {
    defaultConfig {
        ...
-       targetSdkVersion 28
+       targetSdkVersion 29
        ...
    }
}

Btw, I'm pretty sure 0.63.2 already targets API 29

Yup, you can just update it yourself while the upstream is updated. After making the change, run a gradle sync in Android Studio after doing the update to double check that everything went well.

android {
    defaultConfig {
        ...
-       targetSdkVersion 28
+       targetSdkVersion 29
        ...
    }
}

What about other properties, should they also be updated to 29 ?

      { 
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 29
        supportLibVersion = "28.0.0"
    }

Yup, you can just update it yourself while the upstream is updated. After making the change, run a gradle sync in Android Studio after doing the update to double check that everything went well.

```diff

android {

defaultConfig {
    ...
  • targetSdkVersion 28
  • targetSdkVersion 29
    ...
}

}

```

What about other properties, should they also be updated to 29 ?

      { 

        buildToolsVersion = "28.0.3"

        minSdkVersion = 16

        compileSdkVersion = 28

        targetSdkVersion = 29

        supportLibVersion = "28.0.0"

    }

Yes, except for minSdkVersion

@ayox If you do the gradle sync in android studio is should walk you though and give you warnings and versions to update them to.

@ayox @Gustash @aklinker1
API 29 upgrade is not as straightforward as it seems, since it requires some specific handlings for permissions, storage, caching etc.
The changes that may be required are listed in the following links:
https://developer.android.com/about/versions/10/behavior-changes-all
https://developer.android.com/about/versions/10/behavior-changes-all
https://developer.android.com/about/versions/10/behavior-changes-all
https://developer.android.com/about/versions/10/behavior-changes-all

@ayox @Gustash @aklinker1

API 29 upgrade is not as straightforward as it seems, since it requires some specific handlings for permissions, storage, caching etc.

The changes that may be required are listed in the following links:

https://developer.android.com/about/versions/10/behavior-changes-all

https://developer.android.com/about/versions/10/behavior-changes-all

https://developer.android.com/about/versions/10/behavior-changes-all

https://developer.android.com/about/versions/10/behavior-changes-all

I don't think any of these are used in the core. And again, 0.63.2 is already targeting API 29, so I don't even know why this issue is still open

Check #29350

Hey @Gustash , I checked the build.gradle of v0.63.2 https://github.com/facebook/react-native/blob/v0.63.2/ReactAndroid/build.gradle
It shows the targetSDKVersion as 28. Could you help me how you came to know that 0.63.2 is targeting 29?

Go to the Upgrade Helper from 0.62 to 0.63 and check android/build.gradle.

You can also just run npx react-native init TempProject to start a brand new 0.63 project and you'll see it creates an android/build.gradle with API 29 as a target

Also, this is what you should be checking for the files created on react-native init

Hi @Gustash I have a question. I dont want to upgrade my React native version 62.2 to 63.2. Is it enough if i just change android/build.gradle > targetSdkVersion = 28 to 29

Hi @Gustash I have a question. I dont want to upgrade my React native version 62.2 to 63.2. Is it enough if i just change android/build.gradle > targetSdkVersion = 28 to 29

Yes, should be

@amarjain07 have you had problems targeting SDK 29? Application SDK targets override any targets in Android dependencies. Otherwise, could you close this issue?

I believe thumb rule is to have compileSdkVersion should be greater than or equal to the targetSdkVersion
Below is the setting I made for my App
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
excludeAppGlideModule = true
}

I believe thumb rule is to have compileSdkVersion should be greater than or equal to the targetSdkVersion
Below is the setting I made for my App
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
excludeAppGlideModule = true
}

I just did it like @Vasu1990 and rebuild the project.

Closing the issue as it doesn't require any change in the library to support api 29.

Hi, react native 60.5 support api 29?

Was this page helpful?
0 / 5 - 0 ratings