From 7cb38ffaebb1a7946e908a163a01e3e7cff28cf5 Mon Sep 17 00:00:00 2001 From: Ben Henning Date: Fri, 18 Nov 2022 21:31:24 -0800 Subject: [PATCH] Fix #4746: Update app to target SDK 31 (#4747) ## Explanation Fixes #4746 This PR updates the app to target SDK 31 instead of 30 as this is now required for continued Play Store releases. Verification from the PR standpoint heavily relies on CI checks passing. Beyond that, manual testing is needed to ensure no Android behavior changes have led to regressions or new breakages. This PR does NOT include updating Robolectric tests to run on SDK 31 since it's actually much harder than I had expected, and would lead to potential production-affecting changes (as it would require updating Kotlin & potentially other dependencies). #4748 is tracking fixing this in the long-term. ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only N/A, mostly. While this is an infrastructure change, Android component behaviors change with different target SDKs so it's quite possible for there to be UI regressions or issues. Fortunately, most of the UI used by the app is material and Jetpack (meaning it ships with the app and will be mostly unaffected by target SDK changes). --- .../action.yml | 4 ++-- BUILD.bazel | 4 ++-- WORKSPACE | 2 +- app/build.gradle | 4 ++-- app/src/main/AppAndroidManifest.xml | 2 +- app/src/main/DatabindingAdaptersManifest.xml | 2 +- app/src/main/DatabindingResourcesManifest.xml | 2 +- app/src/main/RecyclerviewAdaptersManifest.xml | 2 +- app/src/main/ViewModelManifest.xml | 2 +- app/src/main/ViewModelsManifest.xml | 2 +- app/src/main/ViewsManifest.xml | 2 +- build_flavors.bzl | 14 +++++++------- .../org/oppia/android/config/AndroidManifest.xml | 2 +- data/build.gradle | 4 ++-- data/src/test/AndroidManifest.xml | 2 +- domain/build.gradle | 4 ++-- domain/src/main/AndroidManifest.xml | 2 +- instrumentation/BUILD.bazel | 2 +- testing/build.gradle | 4 ++-- testing/src/test/AndroidManifest.xml | 2 +- utility/build.gradle | 4 ++-- utility/src/main/AndroidManifest.xml | 2 +- 22 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/actions/set-up-android-bazel-build-environment/action.yml b/.github/actions/set-up-android-bazel-build-environment/action.yml index 836e327828b..6b3f5cf1155 100644 --- a/.github/actions/set-up-android-bazel-build-environment/action.yml +++ b/.github/actions/set-up-android-bazel-build-environment/action.yml @@ -72,9 +72,9 @@ runs: $ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platform-tools" shell: bash - - name: Install SDK 30 + - name: Install SDK 31 run: | - $ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platforms;android-30" + $ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platforms;android-31" shell: bash - name: Install build tools 29.0.2 diff --git a/BUILD.bazel b/BUILD.bazel index 81250077b03..5177d895f27 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -117,14 +117,14 @@ package_group( "flavor": "oppia", "min_sdk_version": 21, "multidex": "native", - "target_sdk_version": 30, + "target_sdk_version": 31, }, { "flavor": "oppia_kitkat", "main_dex_list": "//:config/kitkat_main_dex_class_list.txt", "min_sdk_version": 19, "multidex": "manual_main_dex", - "target_sdk_version": 30, + "target_sdk_version": 31, }, ] ] diff --git a/WORKSPACE b/WORKSPACE index 8a7bd724cf7..4585974c87e 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -11,7 +11,7 @@ load("//third_party:versions.bzl", "HTTP_DEPENDENCY_VERSIONS", "get_maven_depend # TODO(#1542): Sync Android SDK version with the manifest. android_sdk_repository( name = "androidsdk", - api_level = 30, + api_level = 31, build_tools_version = "29.0.2", ) diff --git a/app/build.gradle b/app/build.gradle index 4709cf0f06f..1466243e441 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,12 +6,12 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 30 + compileSdkVersion 31 buildToolsVersion "29.0.2" defaultConfig { applicationId "org.oppia.android" minSdkVersion 19 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 1 versionName "1.0" multiDexEnabled true diff --git a/app/src/main/AppAndroidManifest.xml b/app/src/main/AppAndroidManifest.xml index 1c8f666190e..9a5789e1872 100644 --- a/app/src/main/AppAndroidManifest.xml +++ b/app/src/main/AppAndroidManifest.xml @@ -1,5 +1,5 @@ + android:targetSdkVersion="31" /> diff --git a/app/src/main/DatabindingAdaptersManifest.xml b/app/src/main/DatabindingAdaptersManifest.xml index 1ce9e10c160..0974b6b3aa6 100644 --- a/app/src/main/DatabindingAdaptersManifest.xml +++ b/app/src/main/DatabindingAdaptersManifest.xml @@ -1,5 +1,5 @@ + android:targetSdkVersion="31" /> diff --git a/app/src/main/DatabindingResourcesManifest.xml b/app/src/main/DatabindingResourcesManifest.xml index 9b1e93c2052..0c3dd8fa35a 100644 --- a/app/src/main/DatabindingResourcesManifest.xml +++ b/app/src/main/DatabindingResourcesManifest.xml @@ -1,5 +1,5 @@ + android:targetSdkVersion="31" /> diff --git a/app/src/main/RecyclerviewAdaptersManifest.xml b/app/src/main/RecyclerviewAdaptersManifest.xml index f20e30062f0..f2a3273e765 100644 --- a/app/src/main/RecyclerviewAdaptersManifest.xml +++ b/app/src/main/RecyclerviewAdaptersManifest.xml @@ -1,5 +1,5 @@ + android:targetSdkVersion="31" /> diff --git a/app/src/main/ViewModelManifest.xml b/app/src/main/ViewModelManifest.xml index fa31c60ce75..07603e895d8 100644 --- a/app/src/main/ViewModelManifest.xml +++ b/app/src/main/ViewModelManifest.xml @@ -3,5 +3,5 @@ + android:targetSdkVersion="31" /> diff --git a/app/src/main/ViewModelsManifest.xml b/app/src/main/ViewModelsManifest.xml index c44690d380c..84693784fd8 100644 --- a/app/src/main/ViewModelsManifest.xml +++ b/app/src/main/ViewModelsManifest.xml @@ -3,5 +3,5 @@ + android:targetSdkVersion="31" /> diff --git a/app/src/main/ViewsManifest.xml b/app/src/main/ViewsManifest.xml index 10b8d0ef41f..340e35afe29 100644 --- a/app/src/main/ViewsManifest.xml +++ b/app/src/main/ViewsManifest.xml @@ -3,5 +3,5 @@ + android:targetSdkVersion="31" /> diff --git a/build_flavors.bzl b/build_flavors.bzl index 55aec211b65..e141ba1e702 100644 --- a/build_flavors.bzl +++ b/build_flavors.bzl @@ -46,7 +46,7 @@ _FLAVOR_METADATA = { "dev": { "manifest": "//app:src/main/AndroidManifest.xml", "min_sdk_version": 21, - "target_sdk_version": 30, + "target_sdk_version": 31, "multidex": "native", "proguard_specs": [], # Developer builds are not optimized. "production_release": False, @@ -60,7 +60,7 @@ _FLAVOR_METADATA = { "dev_kitkat": { "manifest": "//app:src/main/AndroidManifest.xml", "min_sdk_version": 19, - "target_sdk_version": 30, + "target_sdk_version": 31, "multidex": "manual_main_dex", "main_dex_list": _MAIN_DEX_LIST_TARGET_KITKAT, "proguard_specs": [], # Developer builds are not optimized. @@ -75,7 +75,7 @@ _FLAVOR_METADATA = { "alpha": { "manifest": "//app:src/main/AndroidManifest.xml", "min_sdk_version": 21, - "target_sdk_version": 30, + "target_sdk_version": 31, "multidex": "native", "proguard_specs": _PRODUCTION_PROGUARD_SPECS, "production_release": True, @@ -89,7 +89,7 @@ _FLAVOR_METADATA = { "alpha_kitkat": { "manifest": "//app:src/main/AndroidManifest.xml", "min_sdk_version": 19, - "target_sdk_version": 30, + "target_sdk_version": 31, "multidex": "manual_main_dex", "main_dex_list": _MAIN_DEX_LIST_TARGET_KITKAT, "proguard_specs": [], # TODO(#3886): Re-add Proguard support to alpha_kitkat. @@ -104,7 +104,7 @@ _FLAVOR_METADATA = { "alpha_kenya": { "manifest": "//app:src/main/AndroidManifest.xml", "min_sdk_version": 21, - "target_sdk_version": 30, + "target_sdk_version": 31, "multidex": "native", "proguard_specs": _PRODUCTION_PROGUARD_SPECS, "production_release": True, @@ -118,7 +118,7 @@ _FLAVOR_METADATA = { "beta": { "manifest": "//app:src/main/AndroidManifest.xml", "min_sdk_version": 21, - "target_sdk_version": 30, + "target_sdk_version": 31, "multidex": "native", "proguard_specs": _PRODUCTION_PROGUARD_SPECS, "production_release": True, @@ -132,7 +132,7 @@ _FLAVOR_METADATA = { "ga": { "manifest": "//app:src/main/AndroidManifest.xml", "min_sdk_version": 21, - "target_sdk_version": 30, + "target_sdk_version": 31, "multidex": "native", "proguard_specs": _PRODUCTION_PROGUARD_SPECS, "production_release": True, diff --git a/config/src/java/org/oppia/android/config/AndroidManifest.xml b/config/src/java/org/oppia/android/config/AndroidManifest.xml index e1c019cb70c..1d3f57544f1 100644 --- a/config/src/java/org/oppia/android/config/AndroidManifest.xml +++ b/config/src/java/org/oppia/android/config/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/data/build.gradle b/data/build.gradle index b90bcc469fc..d51015b8c24 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -4,12 +4,12 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 30 + compileSdkVersion 31 buildToolsVersion "29.0.2" defaultConfig { minSdkVersion 19 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/data/src/test/AndroidManifest.xml b/data/src/test/AndroidManifest.xml index 5fd4f17f291..2078d324983 100644 --- a/data/src/test/AndroidManifest.xml +++ b/data/src/test/AndroidManifest.xml @@ -1,5 +1,5 @@ + android:targetSdkVersion="30" /> diff --git a/domain/build.gradle b/domain/build.gradle index 861ea4ae207..b0e246d6e27 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -4,12 +4,12 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 30 + compileSdkVersion 31 buildToolsVersion "29.0.2" defaultConfig { minSdkVersion 19 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 1 versionName "1.0" javaCompileOptions { diff --git a/domain/src/main/AndroidManifest.xml b/domain/src/main/AndroidManifest.xml index 9cdbbca1e9e..483a96cc057 100644 --- a/domain/src/main/AndroidManifest.xml +++ b/domain/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/instrumentation/BUILD.bazel b/instrumentation/BUILD.bazel index 528eec6a433..22a68271e54 100644 --- a/instrumentation/BUILD.bazel +++ b/instrumentation/BUILD.bazel @@ -18,7 +18,7 @@ android_binary( manifest_values = { "applicationId": "org.oppia.android", "minSdkVersion": "19", - "targetSdkVersion": "30", + "targetSdkVersion": "31", "versionCode": "0", "versionName": "0.1-test", }, diff --git a/testing/build.gradle b/testing/build.gradle index 25123a4dd84..9e502acee95 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -4,12 +4,12 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 30 + compileSdkVersion 31 buildToolsVersion "29.0.2" defaultConfig { minSdkVersion 19 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 1 versionName "1.0" } diff --git a/testing/src/test/AndroidManifest.xml b/testing/src/test/AndroidManifest.xml index be2a6519fab..4682f548b88 100644 --- a/testing/src/test/AndroidManifest.xml +++ b/testing/src/test/AndroidManifest.xml @@ -1,5 +1,5 @@ + android:targetSdkVersion="30" /> diff --git a/utility/build.gradle b/utility/build.gradle index 353ea924239..4ffcde26c70 100644 --- a/utility/build.gradle +++ b/utility/build.gradle @@ -4,12 +4,12 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 30 + compileSdkVersion 31 buildToolsVersion "29.0.2" defaultConfig { minSdkVersion 19 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 1 versionName "1.0" javaCompileOptions { diff --git a/utility/src/main/AndroidManifest.xml b/utility/src/main/AndroidManifest.xml index f16271049d7..5a8bce58b67 100644 --- a/utility/src/main/AndroidManifest.xml +++ b/utility/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ - +