Google map inflate exception

I'm trying to use Google map into fragment on Android 4.4.2(19 API) On API 20+ it works fine but on 19 API I have this exception:

android.view.InflateException: Binary XML file line #18: Error inflating class fragment

fragment_map.xml:

     ...
   <fragment xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="match_parent"
            android:layout_height="fill_parent" />
            ...

MapFragment.java

  @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(LAYOUT, container, false);//this row have error on Api 19
        ButterKnife.bind(this, view);
        SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
//        SupportMapFragment mapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager()
//                .findFragmentById(R.id.map); //it's not work on 19 API

        setupListeners();
        return view;
    }

manifest:

     <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.CAMERA" />
 <meta-data
                android:name="com.google.android.geo.API_KEY"
                android:value="@string/google_maps_key" />

gradle:

compile 'com.google.maps.android:android-maps-utils:0.4.3'

full error:

E/AndroidRuntime: FATAL EXCEPTION: main Process: ru.company.getpizza, PID: 10968 android.view.InflateException: Binary XML file line #18: Error inflating class fragment at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at ru.copmany.getpizza.fragments.MapFragment.onCreateView(MapFragment.java:119) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) at a ndroid.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570) at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:164) at android.support.v4.view.ViewPager.populate(ViewPager.java:1177) at android.support.v4.view.ViewPager.populate(ViewPager.java:1025) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1545) at android.view.View.measure(View.java:17040) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5395) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621) at android.widget.LinearLayout.measureVertical(LinearLayout.java:742) at android.widget.LinearLayout.onMeasure(LinearLayout.java:607) at android.view.View.measure(View.java:17040) at android.widget.LinearLayout.measureVertical(LinearLayout.java:926) at android.widget.LinearLayout.onMeasure(LinearLayout.java:607) at android.view.View.measure(View.java:17040) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5395) at android.widget.FrameLayout.onMeasure(FrameLayout.java:340) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135) at android.view.View.measure(View.java:17040) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5395) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621) at android.widget.LinearLayout.measureVertical(LinearLayout.java:742) at android.widget.LinearLayout.onMeasure(LinearLayout.java:607) at android.view.View.measure(View.java:17040) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5395) at android.widget.FrameLayout.onMeasure(FrameLayout.java:340) at android.view.View.measure(View.java:17040) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5395) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621) at android.widget.LinearLa yout.measureVertical(LinearLayout.java:742) at android.widget.LinearLayout.onMeasure(LinearLayout.java:607) at android.view.View.measure(View.java:17040) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5395) at android.widget.FrameLayout.onMeasure(FrameLayout.java:340) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2473) at android.view.View.measure(View.java:17040) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2412) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1380) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1651) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1257) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6424) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788) at android.view.Choreographer.doCallbacks(Choreographer.java:591) at android.view.Choreographer.doFrame(Choreographer.java:560) at android.view.Choreograp her$FrameDisplayEventRe

链接地址: http://www.djcxy.com/p/93048.html

上一篇: 尝试访问API时发生空指针异常

下一篇: Google地图膨胀异常