title: Error inflating class fragment with SupportMapFragment
body: <p>Here is yet another “Error inflating class fragment with SupportMapFragment” issue.</p>
  
  <p>Here is my fragment XML:</p>
  
  <pre><code>&lt;fragment
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/map"
      class="com.google.android.gms.maps.SupportMapFragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.myapp.maptest.MapsActivity" /&gt;
  </code></pre>
  
  <p>Here is my activity (it is started from a NavigationDrawer in the main activity):</p>
  
  <pre><code>public class MapsActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleMap.OnMapLongClickListener {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_maps);
      SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
      mapFragment.getMapAsync(this);
  }
  </code></pre>
  
  <p>Here are the relevant parts of my Manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  &lt;application
      android:name="com.myapp.maptest.AppControl"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/MyTheme"
      android:allowBackup="false"&gt;
      &lt;meta-data
          android:name="com.google.android.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
      &lt;meta-data
          android:name="com.google.android.geo.API_KEY"
          android:value="XXX"/&gt;
      &lt;uses-library android:name="com.google.android.maps" /&gt;
  </code></pre>
  
  <p>obviously there is a real key in there not XXX</p>
  
  <p>here is some relevant code form the build.gradle:</p>
  
  <pre><code>defaultConfig {
      applicationId "com.myapp.maptest"
      minSdkVersion 16
      targetSdkVersion 23
      versionCode 7
      versionName "1.5"
  }
  dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.1.1'
      compile 'com.android.support:support-v4:23.1.1'
      compile 'com.android.support:design:23.1.1'
      compile 'com.google.android.gms:play-services:7.5.0'
  }
  </code></pre>
  
  <p>and here is the error Log (Sorry for the messed up format. Copy and Paste):</p>
  
  <pre><code>01-16 22:49:05.431 10672-10672/com.myapp.maptest E/AndroidRuntime: FATAL EXCEPTION: main
                                                                   Process: com.myapp.maptest, PID: 10672
                                                                   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.maptest/com.myapp.maptest.MapsActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                       at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:148)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                    Caused by: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                       at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
                                                                       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                                                                       at com.myapp.maptest.MapsActivity.onCreate(MapsActivity.java:35)
                                                                       at android.app.Activity.performCreate(Activity.java:6237)
                                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                       at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                       at android.os.Looper.loop(Looper.java:148) 
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                    Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
                                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
                                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                       at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
                                                                       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                       at com.myapp.maptest.MapsActivity.onCreate(MapsActivity.java:35) 
                                                                       at android.app.Activity.performCreate(Activity.java:6237) 
                                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                       at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                       at android.os.Looper.loop(Looper.java:148) 
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.io.File.mkdir()' on a null object reference
                                                                       at com.google.maps.api.android.lib6.gmm6.m.ad.a(Unknown Source)
                                                                       at com.google.maps.api.android.lib6.gmm6.c.h.a(Unknown Source)
                                                                       at com.google.maps.api.android.lib6.gmm6.c.ao.a(Unknown Source)
                                                                       at com.google.maps.api.android.lib6.e.bd.a(Unknown Source)
                                                                       at com.google.maps.api.android.lib6.e.ev.a(Unknown Source)
                                                                       at com.google.maps.api.android.lib6.e.z.a(Unknown Source)
                                                                       at com.google.maps.api.android.lib6.e.y.a(Unknown Source)
                                                                       at com.google.android.gms.maps.internal.u.onTransact(SourceFile:107)
                                                                       at android.os.Binder.transact(Binder.java:387)
                                                                       at com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onCreateView(Unknown Source)
                                                                       at com.google.android.gms.maps.SupportMapFragment$zza.onCreateView(Unknown Source)
                                                                       at com.google.android.gms.dynamic.zza$4.zzb(Unknown Source)
                                                                       at com.google.android.gms.dynamic.zza.zza(Unknown Source)
                                                                       at com.google.android.gms.dynamic.zza.onCreateView(Unknown Source)
                                                                       at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
                                                                       at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
                                                                       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1036)
                                                                       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1226)
                                                                       at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1328)
                                                                       at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2284)
                                                                       at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
                                                                       at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:314)
                                                                       at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
                                                                       at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
                                                                      at android.view.LayoutInflater.createViewFr
  </code></pre>
  
  <p>Other stuff from the log:</p>
  
  <pre><code>01-16 22:49:05.381 10672-10672/com.myapp.maptest I/Google Maps Android API: Google Play services client version: 7571000
  01-16 22:49:05.391 10672-10672/com.myapp.maptest I/Google Maps Android API: Google Play services package version: 8489480
  </code></pre>
  
  <p>The thing is, this has worked perfectly fine (even without the gms.version meta-data) until last nights update for Android Studio. At first I thought  it was just the emulator image that got messed up, but the app also crashes on my phone as soon as the MapActivity tries to inflate the fragment. Debugging says in crashes at setContentView(R.layout.activity_maps); <strong>And I repeat, this exact code has worked before</strong></p>
  
  <p>I have tried to change the activity from AppCompatActivity to FragmentActivity, same error. I have tried to put the fragment XML into a layout, same error. And pretty much anything I found online. Same error.</p>
  
  <p>Any help is greatly appreciated.</p>