我想用Robolectric创建一个ShadowGeocoder:
Field field = FetchAddressIntentService.class.getDeclaredField("geocoder");
field.setAccessible(true);
Geocoder geocoderMemberVariable = (Geocoder) field.get(fetchAddressIntentService);
ShadowGeocoder shadowGeocoder = Shadows.shadowOf(geocoderMemberVariable);
shadowGeocoder.setSimulatedResponse(ADDRESS, CITY, STATE, ZIP, COUNTRY_CODE);
但是在Shadows.shadowOf我收到错误:
Error:(63, 48) error: cannot access OverlayItem
class file for com.google.android.maps.OverlayItem not found
在我的gradle我正在使用:
testCompile "org.robolectric:robolectric:3.0"
testCompile 'org.robolectric:shadows-maps:3.0'
如何解决这个问题?