Skip to content

Commit

Permalink
fix: CI build and runtime for Android 12
Browse files Browse the repository at this point in the history
compileSdk / targetSdk upgrade from API level 30 (Android 11/R) to 31 (Android 12/R) requires additional fixes in order to avoid CI failures on build & LoadKeysWorker crash while running the app on Android 12+ devices.

---------------------

- JDK CI java-version upgrade from 1.8 to 11

- androidx.work:work-runtime-ktx dependency version upgrade from 2.5.0 to 2.7.1 + top-level project dependency override (in order to keep alignment between app & other projects)

- Using androidx.startup to initialize WorkManager (required since work-runtime-ktx:2.6.0)
  • Loading branch information
rawmain authored Jan 12, 2022
1 parent d0c3a63 commit 14513b8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
path: dgca-verifier-app-android
- uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
distribution: adopt
- uses: android-actions/setup-android@v2
- uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
path: dgca-verifier-app-android
- uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
distribution: adopt
- uses: android-actions/setup-android@v2
- uses: actions/cache@v2
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<activity
android:name=".ui.SplashScreenActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -61,10 +62,15 @@
android:screenOrientation="portrait" />

<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="remove" />
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>
</application>

</manifest>
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ allprojects {
google()
jcenter()
}
project.configurations.all {
resolutionStrategy {
force Deps.androidx_worker_ktx
}
}
}

task clean(type: Delete) {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object Versions {
const val androidx_hilt_viewmodel = "1.0.0-alpha02"
const val androidx_hilt_work = work_hilt
const val androidx_hilt_compiler = work_hilt
const val androidx_worker_ktx = "2.5.0"
const val androidx_worker_ktx = "2.7.1"
const val hilt_version = "2.33-beta"

// QR
Expand Down

0 comments on commit 14513b8

Please sign in to comment.