Android IllegalArgumentException:二进制XML文件行#2:膨胀类片段时出错

Android IllegalArgumentException:二进制XML文件行#2:膨胀类片段时出错,android,google-maps-api-2,layout-inflater,illegalargumentexception,Android,Google Maps Api 2,Layout Inflater,Illegalargumentexception,当我把谷歌地图膨胀成一个碎片时,我得到了这个。 错误行位于MapsFragment中: View rootView = inflater.inflate(R.layout.map_fragment,container, false); 主要活动: public class MainActivity extends Activity { public static Context appContext; @Override public void onCreate(Bu

当我把谷歌地图膨胀成一个碎片时,我得到了这个。 错误行位于
MapsFragment
中:

View rootView = inflater.inflate(R.layout.map_fragment,container, false);
主要活动:

public class MainActivity extends Activity {
    public static Context appContext;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // ActionBar gets initiated
        ActionBar actionbar = getActionBar();
        // Tell the ActionBar we want to use Tabs.
        actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        // initiating both tabs and set text to it.
        ActionBar.Tab aroundTab = actionbar.newTab().setText(getString(R.string.title_around));
        ActionBar.Tab mapTab = actionbar.newTab().setText(getString(R.string.title_map));
        ActionBar.Tab favoriteTab = actionbar.newTab().setText(getString(R.string.title_favorite));
        ActionBar.Tab achiveTab = actionbar.newTab().setText(getString(R.string.title_achievement));

        // create the two fragments we want to use for display content
         Fragment map = new MapsFragment();
         Fragment around = new AroundFragment();
         Fragment favorite = new FavoriteFragment();
         Fragment achive = new AchievementFragment();

        // Fragment StationsFragment = new BFragment();

        // set the Tab listener. Now we can listen for clicks.
         aroundTab.setTabListener(new MyTabsListener(map));
         mapTab.setTabListener(new MyTabsListener(around));
         favoriteTab.setTabListener(new MyTabsListener(favorite));
         achiveTab.setTabListener(new MyTabsListener(achive));

        // add the two tabs to the actionbar
        actionbar.addTab(aroundTab);
        actionbar.addTab(mapTab);
        actionbar.addTab(favoriteTab);
        actionbar.addTab(achiveTab);
    }
}
MapsFragment:

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.map_fragment,container, false);
    map = ((MapFragment)getActivity().getFragmentManager().findFragmentById(R.id.map)).getMap();
    map.setMyLocationEnabled(true);
    map.setMapType(GoogleMap.MAP_TYPE_NORMAL);

    mMapFragment = MapFragment.newInstance();
    FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
    fragmentTransaction.add(R.id.map,mMapFragment);
    fragmentTransaction.commit();
    return rootView;
}
舱单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jertt.yummymap"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="17" />
    <uses-library android:name="com.google.android.maps" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <!-- The following two permissions are not required to use
         Google Maps Android API v2, but are recommended. -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.jertt.yummymap.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="AIza******alp2M"/>
    </application>

</manifest>

map_fragment.xml

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

MapsFragment
类的布局文件中指定
android:name
属性:

<fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map"
    android:name="com.jertt.yummymap.MapsFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />


发布logcat get Solution日志您在发布logcat Ready日志时遇到了什么错误。检查这个和你的一样我不明白我该怎么办。