致命异常:主03-26>;13:09:15.145:E/AndroidRuntime(389):java.lang.RuntimeException:>;无法启动活动

致命异常:主03-26>;13:09:15.145:E/AndroidRuntime(389):java.lang.RuntimeException:>;无法启动活动,android,google-maps,android-fragments,Android,Google Maps,Android Fragments,我的代码 private static final LatLng AMSTERDAM = new LatLng(52.37518, 4.895439); private static final LatLng PARIS = new LatLng(48.856132, 2.352448); private static final LatLng FRANKFURT = new LatLng(50.111772, 8.682632); private GoogleMap m

我的代码

private static final LatLng AMSTERDAM = new LatLng(52.37518, 4.895439);
    private static final LatLng PARIS = new LatLng(48.856132, 2.352448);
    private static final LatLng FRANKFURT = new LatLng(50.111772, 8.682632);
    private GoogleMap map;
    private LatLngBounds latlngBounds;
    private Button bNavigation;
    private Polyline newPolyline;
    private boolean isTravelingToParis = false;
    private int width, height;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_navigation);

        getSreenDimanstions();

        map = ((SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map)).getMap();

        bNavigation = (Button) findViewById(R.id.bNavigation);
        bNavigation.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (!isTravelingToParis)
                {
                    isTravelingToParis = true;
                    findDirections( AMSTERDAM.latitude, AMSTERDAM.longitude,PARIS.latitude, PARIS.longitude, GMapV2Direction.MODE_DRIVING );
                }
                else
                {
                    isTravelingToParis = false;
                    findDirections( AMSTERDAM.latitude, AMSTERDAM.longitude, FRANKFURT.latitude, FRANKFURT.longitude, GMapV2Direction.MODE_DRIVING );  
                }
            }
        });
    }

    @Override
    protected void onResume() {

        super.onResume();
        latlngBounds = createLatLngBoundsObject(AMSTERDAM, PARIS);
        map.moveCamera(CameraUpdateFactory.newLatLngBounds(latlngBounds, width, height, 150));

    }

    public void handleGetDirectionsResult(ArrayList<LatLng> directionPoints) {
        PolylineOptions rectLine = new PolylineOptions().width(5).color(Color.RED);

        for(int i = 0 ; i < directionPoints.size() ; i++) 
        {          
            rectLine.add(directionPoints.get(i));
        }
        if (newPolyline != null)
        {
            newPolyline.remove();
        }
        newPolyline = map.addPolyline(rectLine);
        if (isTravelingToParis)
        {
            latlngBounds = createLatLngBoundsObject(AMSTERDAM, PARIS);
            map.animateCamera(CameraUpdateFactory.newLatLngBounds(latlngBounds, width, height, 150));
        }
        else
        {
            latlngBounds = createLatLngBoundsObject(AMSTERDAM, FRANKFURT);
            map.animateCamera(CameraUpdateFactory.newLatLngBounds(latlngBounds, width, height, 150));
        }

    }

    private void getSreenDimanstions()
    {
        Display display = getWindowManager().getDefaultDisplay();
        width = display.getWidth(); 
        height = display.getHeight(); 
    }

    private LatLngBounds createLatLngBoundsObject(LatLng firstLocation, LatLng secondLocation)
    {
        if (firstLocation != null && secondLocation != null)
        {
            LatLngBounds.Builder builder = new LatLngBounds.Builder();    
            builder.include(firstLocation).include(secondLocation);

            return builder.build();
        }
        return null;
    }

    public void findDirections(double fromPositionDoubleLat, double fromPositionDoubleLong, double toPositionDoubleLat, double toPositionDoubleLong, String mode)
    {
        Map<String, String> map = new HashMap<String, String>();
        map.put(GetDirectionsAsyncTask.USER_CURRENT_LAT, String.valueOf(fromPositionDoubleLat));
        map.put(GetDirectionsAsyncTask.USER_CURRENT_LONG, String.valueOf(fromPositionDoubleLong));
        map.put(GetDirectionsAsyncTask.DESTINATION_LAT, String.valueOf(toPositionDoubleLat));
        map.put(GetDirectionsAsyncTask.DESTINATION_LONG, String.valueOf(toPositionDoubleLong));
        map.put(GetDirectionsAsyncTask.DIRECTIONS_MODE, mode);

        GetDirectionsAsyncTask asyncTask = new GetDirectionsAsyncTask(this);
        asyncTask.execute(map); 
    }
    }
阿姆斯特丹私人静态最终车床=新车床(52.37518,4.895439);
私人静态最终车床巴黎=新车床(48.856132,2.352448);
法兰克福私人静态最终车床=新车床(50.111772,8.682632);
私人谷歌地图;
私人停车场停车场;
私人航空;
私有多段线新建多段线;
私有布尔值isTravelingToParis=false;
私人int宽度、高度;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity\u导航);
getsreendimanstations();
map=((SupportMapFragment)getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
bNavigation=(按钮)findViewById(R.id.bNavigation);
bNavigation.setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图v){
如果(!isTravelingToParis)
{
isTravelingToParis=真;
查找方向(阿姆斯特丹.纬度,阿姆斯特丹.经度,巴黎.纬度,巴黎.经度,GMapV2Direction.MODE_驾驶);
}
其他的
{
isTravelingToParis=假;
查找方向(阿姆斯特丹.纬度,阿姆斯特丹.经度,法兰克福.纬度,法兰克福.经度,GMapV2Direction.MODE_驾驶);
}
}
});
}
@凌驾
受保护的void onResume(){
super.onResume();
latlngBounds=createLatLngBoundsObject(阿姆斯特丹,巴黎);
map.moveCamera(CameraUpdateFactory.newLatLngBounds(latlngBounds,宽度,高度,150));
}
公共无效handleGetDirectionsResult(ArrayList directionPoints){
PolylineOptions rectLine=新的PolylineOptions().width(5).color(color.RED);
对于(int i=0;i
MyLogCat

03-26 13:09:15.145:E/AndroidRuntime(389):致命异常:主03-26 13:09:15.145:E/AndroidRuntime(389):java.lang.RuntimeException: 无法启动活动 ComponentInfo{com.emildesign.navigationapplication/com.emildesign.navigationapplication.NavigationActivity}: android.view.InflateException:二进制XML文件行#7:错误 膨胀类碎片03-26 13:09:15.145:E/AndroidRuntime(389): 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2249) 03-26 13:09:15.145:E/AndroidRuntime(389):在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299) 03-26 13:09:15.145:E/AndroidRuntime(389):在 android.app.ActivityThread.access$700(ActivityThread.java:154)03-26 13:09:15.145:E/AndroidRuntime(389):在 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284) 03-26 13:09:15.145:E/AndroidRuntime(389):在 android.os.Handler.dispatchMessage(Handler.java:99)03-26 13:09:15.145:E/AndroidRuntime(389):在 android.os.Looper.loop(Looper.java:137)03-26 13:09:15.145: E/AndroidRuntime(389):在 android.app.ActivityThread.main(ActivityThread.java:5306)03-26 13:09:15.145:E/AndroidRuntime(389):在 java.lang.reflect.Method.Invokenactive(本机方法)03-26 13:09:15.145:E/AndroidRuntime(389):在 java.lang.reflect.Method.invoke(Method.java:511)03-26 13:09:15.145: E/AndroidRuntime(389):在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 03-26 13:09:15.145:E/AndroidRuntime(389):在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)03-26 13:09:15.145:E/AndroidRuntime(389):在 dalvik.system.Nativestar.main(本地方法)03-26 13:09:15.145: E/AndroidRuntime(389):由以下原因引起:android.view.InflateException: 二进制XML文件行
 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.emildesign.navigationapplication"
    android:versionCode="1"
    android:versionName="1.0" >

    <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="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="com.emildesign.navigationapplication.permission.MAPS_RECEIVE" />

    <permission
        android:name="com.emildesign.navigationapplication.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <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.emildesign.navigationapplication.NavigationActivity"
            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="ichangeditforyou" />
    </application>

</manifest>
 <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment" />

    <Button
        android:id="@+id/bNavigation"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_margin="5dp"
        android:text="Navigate" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />