From 9fc0027ff345bfc5f662094fdaf52a7cd283f2a8 Mon Sep 17 00:00:00 2001 From: Andrei Shikov Date: Tue, 16 Nov 2021 08:30:25 -0800 Subject: [PATCH] Bump OSS Android build to SDK 31 (#32606) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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 21 Differential Revision: D32107409 fbshipit-source-id: d8bf0ff95943323ccd82f9596fcbf4264911c680 --- .circleci/config.yml | 2 +- ReactAndroid/build.gradle | 4 ++-- ReactAndroid/src/androidTest/AndroidManifest.xml | 1 + .../src/androidTest/buck-runner/AndroidManifest.xml | 3 ++- .../facebook/react/devsupport/BridgeDevSupportManager.java | 2 +- .../src/test/kotlin/com/facebook/react/ReactPluginTest.kt | 6 +++--- packages/rn-tester/android/app/build.gradle | 4 ++-- packages/rn-tester/android/app/src/main/AndroidManifest.xml | 5 +++-- scripts/.tests.env | 4 ++-- template/android/app/src/debug/AndroidManifest.xml | 2 +- template/android/app/src/main/AndroidManifest.xml | 3 ++- template/android/build.gradle | 4 ++-- 12 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index df40a63aa3782e..5f677b914322ac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -642,7 +642,7 @@ jobs: environment: - ANDROID_HOME: "C:\\Android\\android-sdk" - ANDROID_NDK: "C:\\Android\\android-sdk\\ndk\\20.1.5948944" - - ANDROID_BUILD_VERSION: 30 + - ANDROID_BUILD_VERSION: 31 - ANDROID_TOOLS_VERSION: 30.0.2 - GRADLE_OPTS: -Dorg.gradle.daemon=false - NDK_VERSION: 21.4.7075529 diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 47ca5dfc72bde1..4f0866540ddd02 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -271,7 +271,7 @@ task installArchives { } android { - compileSdkVersion 30 + compileSdkVersion 31 if (project.hasProperty("ANDROID_NDK_VERSION")) { ndkVersion project.property("ANDROID_NDK_VERSION") } @@ -281,7 +281,7 @@ android { defaultConfig { minSdkVersion(21) - targetSdkVersion(28) + targetSdkVersion(31) versionCode(1) versionName("1.0") diff --git a/ReactAndroid/src/androidTest/AndroidManifest.xml b/ReactAndroid/src/androidTest/AndroidManifest.xml index 0ebc7b4768ecba..31552b1abc0ba2 100644 --- a/ReactAndroid/src/androidTest/AndroidManifest.xml +++ b/ReactAndroid/src/androidTest/AndroidManifest.xml @@ -14,6 +14,7 @@ diff --git a/ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml b/ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml index 49b4a1fc433c31..5e31d4403b2d20 100644 --- a/ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml +++ b/ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml @@ -15,7 +15,8 @@ + android:theme="@style/Theme.ReactNative.AppCompat.Light.NoActionBar.FullScreen" + android:exported="false"> diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java index 30c0840f90dfb8..ea1b53c83ebcf5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java @@ -58,7 +58,7 @@ * * IMPORTANT: In order for developer support to work correctly it is required that the * manifest of your application contain the following entries: - * {@code } + * {@code } * {@code } */ public final class BridgeDevSupportManager extends DevSupportManagerBase { diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt index 602dd522f40960..1bf7fd5a1c112e 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt @@ -20,7 +20,7 @@ class ReactPluginTest { project.plugins.apply("com.android.application") project.plugins.apply("com.facebook.react") - project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(30) } + project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) } project.extensions.getByType(ReactExtension::class.java).apply { applyAppPlugin.set(true) cliPath.set(".") @@ -36,7 +36,7 @@ class ReactPluginTest { project.plugins.apply("com.android.application") project.plugins.apply("com.facebook.react") - project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(30) } + project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) } project.extensions.getByType(ReactExtension::class.java).apply { applyAppPlugin.set(false) } assertTrue(project.getTasksByName("bundleDebugJsAndAssets", false).isEmpty()) @@ -48,7 +48,7 @@ class ReactPluginTest { project.plugins.apply("com.android.application") project.plugins.apply("com.facebook.react") - project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(30) } + project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) } project.extensions.getByType(ReactExtension::class.java).apply { applyAppPlugin.set(false) } assertTrue(project.getTasksByName("buildCodegenCLI", false).isNotEmpty()) diff --git a/packages/rn-tester/android/app/build.gradle b/packages/rn-tester/android/app/build.gradle index a2de00ba8fec3b..5d0ea99825f3d6 100644 --- a/packages/rn-tester/android/app/build.gradle +++ b/packages/rn-tester/android/app/build.gradle @@ -141,7 +141,7 @@ def reactNativeArchitectures() { } android { - compileSdkVersion 29 + compileSdkVersion 31 if (project.hasProperty("ANDROID_NDK_VERSION")) { ndkVersion project.property("ANDROID_NDK_VERSION") } @@ -165,7 +165,7 @@ android { defaultConfig { applicationId "com.facebook.react.uiapp" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 31 versionCode 1 versionName "1.0" testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type diff --git a/packages/rn-tester/android/app/src/main/AndroidManifest.xml b/packages/rn-tester/android/app/src/main/AndroidManifest.xml index 8ee8ae3a352256..f50034f92519f8 100644 --- a/packages/rn-tester/android/app/src/main/AndroidManifest.xml +++ b/packages/rn-tester/android/app/src/main/AndroidManifest.xml @@ -36,7 +36,8 @@ android:label="@string/app_name" android:screenOrientation="fullSensor" android:launchMode="singleTask" - android:configChanges="orientation|screenSize|uiMode" > + android:configChanges="orientation|screenSize|uiMode" + android:exported="true"> @@ -51,7 +52,7 @@ - + - + diff --git a/template/android/app/src/main/AndroidManifest.xml b/template/android/app/src/main/AndroidManifest.xml index 9ec74db36bf5e3..7ba57ca1dc0587 100644 --- a/template/android/app/src/main/AndroidManifest.xml +++ b/template/android/app/src/main/AndroidManifest.xml @@ -15,7 +15,8 @@ android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:launchMode="singleTask" - android:windowSoftInputMode="adjustResize"> + android:windowSoftInputMode="adjustResize" + android:exported="true"> diff --git a/template/android/build.gradle b/template/android/build.gradle index 3be1031fb223dd..8e82375aefcd5d 100644 --- a/template/android/build.gradle +++ b/template/android/build.gradle @@ -4,8 +4,8 @@ buildscript { ext { buildToolsVersion = "30.0.2" minSdkVersion = 21 - compileSdkVersion = 30 - targetSdkVersion = 30 + compileSdkVersion = 31 + targetSdkVersion = 31 ndkVersion = "21.4.7075529" } repositories {