Skip to content

Commit 00ac034

Browse files
Andrei Shikovfacebook-github-bot
Andrei Shikov
authored andcommitted
Bump OSS Android build to SDK 31 (#32606)
Summary: Pull Request resolved: #32606 Updates OSS builds for internals and template to target SDK 31, corresponding to Android 12. Changelog: [Updated][Android] - Bump Android compile and target SDK to 31 Reviewed By: cortinico Differential Revision: D32107409 fbshipit-source-id: 57f219d33e884200ca4f49e1afe1bfd65b0d6315
1 parent 28aeb7b commit 00ac034

File tree

14 files changed

+28
-24
lines changed

14 files changed

+28
-24
lines changed

.circleci/Dockerfiles/Dockerfile.android

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# and build a Android application that can be used to run the
1515
# tests specified in the scripts/ directory.
1616
#
17-
FROM reactnativecommunity/react-native-android:5.1
17+
FROM reactnativecommunity/react-native-android:5.2
1818

1919
LABEL Description="React Native Android Test Image"
2020
LABEL maintainer="Héctor Ramos <[email protected]>"

.circleci/config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ executors:
3636
reactnativeandroid:
3737
<<: *defaults
3838
docker:
39-
- image: reactnativecommunity/react-native-android:5.1
39+
- image: reactnativecommunity/react-native-android:5.2
4040
resource_class: "large"
4141
environment:
4242
- TERM: "dumb"
@@ -649,8 +649,8 @@ jobs:
649649
environment:
650650
- ANDROID_HOME: "C:\\Android\\android-sdk"
651651
- ANDROID_NDK: "C:\\Android\\android-sdk\\ndk\\20.1.5948944"
652-
- ANDROID_BUILD_VERSION: 30
653-
- ANDROID_TOOLS_VERSION: 30.0.2
652+
- ANDROID_BUILD_VERSION: 31
653+
- ANDROID_TOOLS_VERSION: 31.0.0
654654
- GRADLE_OPTS: -Dorg.gradle.daemon=false
655655
- NDK_VERSION: 21.4.7075529
656656
steps:

ReactAndroid/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ task installArchives {
273273
}
274274

275275
android {
276-
compileSdkVersion 30
276+
compileSdkVersion 31
277277
if (project.hasProperty("ANDROID_NDK_VERSION")) {
278278
ndkVersion project.property("ANDROID_NDK_VERSION")
279279
}
@@ -283,7 +283,7 @@ android {
283283

284284
defaultConfig {
285285
minSdkVersion(21)
286-
targetSdkVersion(28)
286+
targetSdkVersion(31)
287287
versionCode(1)
288288
versionName("1.0")
289289

ReactAndroid/src/androidTest/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<activity
1515
android:name="com.facebook.react.testing.ReactAppTestActivity"
1616
android:theme="@style/Theme.ReactNative.AppCompat.Light.NoActionBar.FullScreen"
17+
android:exported="false"
1718
/>
1819
</application>
1920
</manifest>

ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
<uses-library android:name="android.test.runner" />
1616
<activity
1717
android:name="com.facebook.react.testing.ReactAppTestActivity"
18-
android:theme="@style/Theme.ReactNative.AppCompat.Light.NoActionBar.FullScreen">
18+
android:theme="@style/Theme.ReactNative.AppCompat.Light.NoActionBar.FullScreen"
19+
android:exported="false">
1920
</activity>
2021
</application>
2122

ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
*
5959
* IMPORTANT: In order for developer support to work correctly it is required that the
6060
* manifest of your application contain the following entries:
61-
* {@code <activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>}
61+
* {@code <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>}
6262
* {@code <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>}
6363
*/
6464
public final class BridgeDevSupportManager extends DevSupportManagerBase {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"prettier": "prettier --write \"./**/*.{js,md,yml}\"",
6868
"format-check": "prettier --list-different \"./**/*.{js,md,yml}\"",
6969
"update-lock": "npx yarn-deduplicate",
70-
"docker-setup-android": "docker pull reactnativecommunity/react-native-android:5.1",
70+
"docker-setup-android": "docker pull reactnativecommunity/react-native-android:5.2",
7171
"docker-build-android": "docker build -t reactnativeci/android -f .circleci/Dockerfiles/Dockerfile.android .",
7272
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh",
7373
"test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh",

packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ReactPluginTest {
2020
project.plugins.apply("com.android.application")
2121
project.plugins.apply("com.facebook.react")
2222

23-
project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(30) }
23+
project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) }
2424
project.extensions.getByType(ReactExtension::class.java).apply {
2525
applyAppPlugin.set(true)
2626
cliPath.set(".")
@@ -36,7 +36,7 @@ class ReactPluginTest {
3636
project.plugins.apply("com.android.application")
3737
project.plugins.apply("com.facebook.react")
3838

39-
project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(30) }
39+
project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) }
4040
project.extensions.getByType(ReactExtension::class.java).apply { applyAppPlugin.set(false) }
4141

4242
assertTrue(project.getTasksByName("bundleDebugJsAndAssets", false).isEmpty())
@@ -48,7 +48,7 @@ class ReactPluginTest {
4848
project.plugins.apply("com.android.application")
4949
project.plugins.apply("com.facebook.react")
5050

51-
project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(30) }
51+
project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) }
5252
project.extensions.getByType(ReactExtension::class.java).apply { applyAppPlugin.set(false) }
5353

5454
assertTrue(project.getTasksByName("buildCodegenCLI", false).isNotEmpty())

packages/rn-tester/android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def reactNativeArchitectures() {
142142
}
143143

144144
android {
145-
compileSdkVersion 29
145+
compileSdkVersion 31
146146
if (project.hasProperty("ANDROID_NDK_VERSION")) {
147147
ndkVersion project.property("ANDROID_NDK_VERSION")
148148
}
@@ -163,7 +163,7 @@ android {
163163
defaultConfig {
164164
applicationId "com.facebook.react.uiapp"
165165
minSdkVersion 21
166-
targetSdkVersion 29
166+
targetSdkVersion 31
167167
versionCode 1
168168
versionName "1.0"
169169
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type

packages/rn-tester/android/app/src/main/AndroidManifest.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
android:label="@string/app_name"
3737
android:screenOrientation="fullSensor"
3838
android:launchMode="singleTask"
39-
android:configChanges="orientation|screenSize|uiMode" >
39+
android:configChanges="orientation|screenSize|uiMode"
40+
android:exported="true">
4041
<intent-filter>
4142
<action android:name="android.intent.action.MAIN" />
4243
<category android:name="android.intent.category.LAUNCHER" />
@@ -51,7 +52,7 @@
5152
<data android:scheme="rntester" android:host="example" />
5253
</intent-filter>
5354
</activity>
54-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
55+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
5556
<provider
5657
android:name="com.facebook.react.modules.blob.BlobProvider"
5758
android:authorities="@string/blob_provider_authority"

scripts/.tests.env

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
## ANDROID ##
66
# Android SDK Build Tools revision
7-
export ANDROID_SDK_BUILD_TOOLS_REVISION=30.0.2
7+
export ANDROID_SDK_BUILD_TOOLS_REVISION=31.0.0
88
# Android API Level we build with
9-
export ANDROID_SDK_BUILD_API_LEVEL="28"
9+
export ANDROID_SDK_BUILD_API_LEVEL="31"
1010
# Google APIs for Android level
1111
export ANDROID_GOOGLE_API_LEVEL="23"
1212
# Minimum Android API SDK Level we target
1313
export ANDROID_SDK_MINIMUM_API_LEVEL="21"
1414
# Target API SDK level to build for
15-
export ANDROID_SDK_TARGET_API_LEVEL="29"
15+
export ANDROID_SDK_TARGET_API_LEVEL="31"
1616
# Android Image SDK level to install on the emulator
1717
export ANDROID_SYSTEM_IMAGE_API_LEVEL="21"
1818

template/android/app/src/debug/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
android:usesCleartextTraffic="true"
99
tools:targetApi="28"
1010
tools:ignore="GoogleAppIndexingWarning">
11-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
11+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
1212
</application>
1313
</manifest>

template/android/app/src/main/AndroidManifest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
android:label="@string/app_name"
1616
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
1717
android:launchMode="singleTask"
18-
android:windowSoftInputMode="adjustResize">
18+
android:windowSoftInputMode="adjustResize"
19+
android:exported="true">
1920
<intent-filter>
2021
<action android:name="android.intent.action.MAIN" />
2122
<category android:name="android.intent.category.LAUNCHER" />

template/android/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "30.0.2"
5+
buildToolsVersion = "31.0.0"
66
minSdkVersion = 21
7-
compileSdkVersion = 30
8-
targetSdkVersion = 30
7+
compileSdkVersion = 31
8+
targetSdkVersion = 31
99
ndkVersion = "21.4.7075529"
1010
}
1111
repositories {

0 commit comments

Comments
 (0)