Update Your React Native App to the Latest API Level 31

Shivam Thaker
JavaScript in Plain English
2 min readFeb 10, 2023

--

Though it is a simple process sometimes it takes too much time to find simple solutions, I am writing this blog so that you can do it fast.

After google gives Target API level requirements dedline.(we are delaying the enforcement deadline for app discoverability from November 1, 2022 to January 31, 2023. You can continue to request an extension if you need more time to update your app to target API level 31). So many developer stuck how upload new version in play console.

Developer stuck because if update react native version that’s time need to update so many library & it’s time taking.

Inside “android/build.gradle” replace existing code with the below code, buildToolsVersion(If minSdkVersion 31 then set buildToolsVersion = “30.0.2” ) & different google service version set according your need.

open AndroidManifest using blow path

android/app/src/main/AndroidManifest.xml

Search <activity in entire file. All the <activity inside add android:exported=”false” in all place like below.

 <activity android:name="com.facebook.react.devsupport.DevSettingsActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
android:launchMode="singleTop"
android:exported="false"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Also some changes in “android/app/build.gradle” inside dependencies


implementation 'androidx.work:work-runtime-ktx:2.7.0'

Also some changes in “android/build.gradle” inside allprojects like below. set your current react-native version expect “0.63.4”.

allprojects {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:0.63.4"
}
}

...

Now your app should run on android 12.

More content at PlainEnglish.io. Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord.

Interested in scaling your software startup? Check out Circuit.

--

--

mobitech Enthusiast, who loves to write anything around mobile application Development. You can follow me here: www.linkedin.com/in/shivam-thakar-546144238