Skip to content

Conversation

hoisie
Copy link
Contributor

@hoisie hoisie commented Jul 26, 2024

Fixes #9357

testRuntimeOnly files("${System.getenv("ANDROID_HOME")}/platforms/android-34/android.jar")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should define a variable in Gradle with the compile SDK version, so we can use it everywhere, and in particular her.
I have a feeling it will be rather easy to forget to update this value when compile SDK is changed (I suppose that's why 34 is used?).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah definitely a good idea, this PR is still a WIP, just trying to see if this will cause any issues.

@hoisie hoisie force-pushed the depend-on-stubs branch 2 times, most recently from f8bb8d0 to 5ad563e Compare July 27, 2024 02:14
@utzcoz
Copy link
Member

utzcoz commented Jul 27, 2024

@Mia0451 I think this PR can solve your problems.

@hoisie hoisie requested a review from utzcoz July 27, 2024 15:43
@hoisie hoisie force-pushed the depend-on-stubs branch 2 times, most recently from e2011ee to 4765657 Compare July 29, 2024 18:58
Previously, the android-all from U was on the runtime classpath when running
Robolectric tests. This gave tests the ability to use any class from Android U,
even on older SDK levels.

Update the gradle logic to include the android 34 stubs jar on the classpath.
If tests for an older SDK level inadvertently try to use classes from U, a
Stub! exception will be thrown.

Fixes robolectric#9357
@hoisie hoisie force-pushed the depend-on-stubs branch from 4765657 to 6b0e03d Compare July 30, 2024 16:00
@hoisie hoisie merged commit eafe846 into robolectric:master Jul 30, 2024
22 checks passed
@hoisie hoisie deleted the depend-on-stubs branch July 30, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Robolectric's android-all should not be on the runtime classpath when running Robolectric tests
3 participants