Google Map crashing with Resources$NotFoundException when replaced in FrameLayout : <p>This how I am adding map dynamically in FrameLayout.  </p>

<pre><code>new Handler().postDelayed(() -&gt; {
  if (isAdded()) {
   new Thread(() -&gt; {
    try {
     SupportMapFragment mf = SupportMapFragment.newInstance();
     getChildFragmentManager().beginTransaction()
      .replace(R.id.view_map, mf)
      .commit();
     mActivity.runOnUiThread(() -&gt; mf.getMapAsync(this));
    } catch (Exception ignored) {}
   }).start();
  }
 }, 100);
</code></pre>

<p>It is working fine but in some cases the app is crashing with <code>Resources$NotFoundException</code>. This is the crash log.</p>

<pre><code>android.content.res.Resources$NotFoundException: Resource ID #0x7f07000f
at android.content.res.Resources.getValue(Resources.java: 1266) 
at android.content.res.Resources.getDimensionPixelSize(Resources.java: 673)
at maps.ad.ay. &lt; init &gt; (Unknown Source)
at maps.ad.ay. &lt; init &gt; (Unknown Source)
at maps.ad.t.a(Unknown Source)
at maps.ad.M.a(Unknown Source)
at wd.onTransact(: com.google.android.gms.DynamiteModulesB: 107)
at android.os.Binder.transact(Binder.java: 380)
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: 2080)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java: 1108)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java: 1290)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java: 801)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java: 1677)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java: 536)
at android.os.Handler.handleCallback(Handler.java: 746)
at android.os.Handler.dispatchMessage(Handler.java: 95)
at android.os.Looper.loop(Looper.java: 135)
at android.app.ActivityThread.main(ActivityThread.java: 5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java: 372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 702)
</code></pre>
