Closed utzcoz closed 4 weeks ago
@MGaetan89 @hoisie Looks like RotionalTest can't work with SDK34 Emulator.
java.lang.NoSuchFieldException: java.lang.AssertionError: java.lang.NoSuchFieldException: No field mNumerator in class Landroid/util/Rational; (declaration of 'android.util.Rational' appears in /system/framework/framework.jar!classes3.dex)
at android.util.RationalTest.mutateField(RationalTest.java:524)
at android.util.RationalTest.createIllegalRational(RationalTest.java:513)
at android.util.RationalTest.testSerialize(RationalTest.java:345)
Looking at the source of Rational
, we can that mNumerator
and mDenominator
exist, but are restricted since API 30 (Android R):
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
private final int mNumerator;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
private final int mDenominator;
Our RationalTest
, which comes from Andorid's CTS, still seem to be up to date: https://cs.android.com/android/platform/superproject/main/+/main:cts/tests/tests/util/src/android/util/cts/RationalTest.java
I don't know if there is a way to bypass this restriction on Robolectric side. Or if we should only run the tests that use createIllegalRational()
on API < 30.
What do you think?
It is not failed when running it with Robolectric, and it is failed when running in Android Emulator as there are hidden API restrictions. We might need to bypass this restriction when running tests. I am trying it locally.
@MGaetan89 Because AOSP CTS disables hidden-api checking for RationalTest
: https://cs.android.com/android/platform/superproject/main/+/main:cts/tests/tests/util/AndroidTest.xml;l=31.
@MGaetan89 I made a new CL to run illegal serialization only on devices before Android S.
@MGaetan89 @hoisie Let's land SDK 34 Emulator testing again to capture potential compatibility issues like RationalTest.
We have set the density to 240 for Emulators, and we can try to enable it for SDK 34 again to test stability.