Skip to content

Use roboelectric to test whether Java library works on Android API version x? #7771

Answered by hoisie
p-bakker asked this question in Q&A
Discussion options

You must be logged in to vote

What we are interested in is having caught that for example javax.lang.model.SourceVersion is not available on Android or that java.util.Map.putIfAbsent is not available on Android api version 21.

Robolectric can detect incompatibilities in Android API but not Java APIs. I think these days you need at least Java 9 TO run Robolectric. If you want more comprehensive compatibility tests that can check Java incompatibilities I'd recommend emulator tests. In theory there may be something you can do with custom instrumentation but it may be complex.

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@utzcoz
Comment options

Comment options

You must be logged in to vote
1 reply
@utzcoz
Comment options

Answer selected by p-bakker
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants