Fixed
Status Update
Comments
ja...@google.com <ja...@google.com>
je...@google.com <je...@google.com>
sp...@google.com <sp...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
tn...@google.com <tn...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
tn...@google.com <tn...@google.com>
sa...@google.com <sa...@google.com> #4
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Chipmunk Canary 1 (2021.2.1.1)
- Android Gradle Plugin 7.2.0-alpha01
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Description
After enabling lint on
test
sources, theNewApi
lint check will be triggered in robolectric tests even if the test is configured with aminSdk
lower than the API being used. To work around this issues, users are required to add a redundant@RequiresApi()
or@TargetApi()
annotation to their test method or test class.STEPS TO REPRODUCE:
test
sources insidebuild.gradle
:src/test/...
@Config(minSdk = <minsdk>)
(orrobolectric.properties
android.defaultConfig.minSdkVersion
is lower thanminsdk
so it doesn't get suppressed that way.sdk
<=minsdk
(I usedandroid.util.Size
which was added in API 21 and setminsdk
to 23, for example). Alternatively, annotate a method or class with@RequiresApi(<sdk>)
and use it in a test../gradlew app:lint
and seeNewApi
failures.Example:
Studio Build:
Version of Gradle Plugin:
7.1.0-alpha03