Q:

How does Robolectric work?  Why does my unit test download some jars while first run Unit Test? 

I am going to run a Unit Test in Android Studio, to test my method in ViewModel, I use Robolectric to do this. 
Everything works correctly.  I found when i run test first time, it downloads some jars automaticly.  like org.robolectric:android-all:jar:5.0.0_r2-robolectric-1. 
So can anybody tell me how does Robolectric download jars, By gradle?  or something else?  And why does it need these jars? 

A:

It is not gradle.  I think it is just junit test runner.  
Robolectric loads Android dependency on the first run.  And it downloads it from maven repository. 
Robolectric downloads compiled sources of AOSP project to avoid mocking/faking entire Android system

