diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 57027c116..a498075dd 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -89,15 +89,34 @@ android { } } - // Starting with Android Studio 3 Robolectric is unable to find resources. - // The following allows it to find the resources. - testOptions.unitTests.isIncludeAndroidResources = true tasks.withType().configureEach { testLogging { events("started", "passed", "skipped", "failed") } } + testOptions { + unitTests { + // Starting with Android Studio 3 Robolectric is unable to find resources. + // The following allows it to find the resources. + isIncludeAndroidResources = true + all { + // Needed on Java 17 and up + it.jvmArgs( + "--add-opens=java.base/java.lang=ALL-UNNAMED", + "--add-opens=java.base/java.util=ALL-UNNAMED", + "--add-opens=java.base/java.io=ALL-UNNAMED", + "--add-opens=java.base/java.net=ALL-UNNAMED", + "--add-opens=java.base/java.security=ALL-UNNAMED", + "--add-opens=java.base/java.text=ALL-UNNAMED", + "--add-opens=java.base/jdk.internal.access=ALL-UNNAMED", + "--add-opens=java.desktop/java.awt.font=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", + ) + } + } + } + lint { lintConfig = file("lint.xml") } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f29b475b9..b15517cf7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -59,7 +59,7 @@ androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version androidx-test-uiautomator-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version = "2.4.0" } androidx-test-espresso-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version = "3.7.0" } junit-junit = { group = "junit", name = "junit", version = "4.13.2" } -org-robolectric-robolectric = { group = "org.robolectric", name = "robolectric", version = "4.16.1" } +org-robolectric-robolectric = { group = "org.robolectric", name = "robolectric", version = "4.17" } [plugins] com-android-application = { id = "com.android.application", version = "9.4.0" }