Fix internal access error

https://robolectric.org/getting-started/#running-with-java-17-and-higher
This commit is contained in:
Sylvia van Os committed 2026-09-18 19:45:59 +02:00
1 parent 1f62156d89
commit 90ceb6d6ab
1 file changed
+22 -3
+22 -3
View File
@@ -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<Test>().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")
}