java - Why am i getting Error inflating class fragment in my android test? -


when run application receive no errors, when try run test using activity includes fragment receive inflation error.

i have been trying resolve past few hours , getting no where.

this fragment part of xml.

<fragment     android:layout_margintop="30dp"     android:layout_gravity="center_horizontal"     android:layout_width="300dip"     android:layout_height="300dip"     android:id="@+id/map"     android:name="com.google.android.gms.maps.supportmapfragment"     /> 

and test fails.

public class testresultsactivity extends activityunittestcase<resultspage> {  resultspage resultspage; public testresultsactivity() {     super(resultspage.class); }  @override protected void setup() throws exception {     super.setup();     intent intent = new intent(getinstrumentation().gettargetcontext(),             resultspage.class);     startactivity(intent, null, null);     resultspage = getactivity(); }  @smalltest public void testresultspage() {     assertnotnull(resultspage.findviewbyid(r.id.map));     assertnotnull(resultspage.findviewbyid(r.id.ratingbar)); }    } 

can tell me causing , how can go fixing/ avoiding it?