I am following Google Maps Android API v2 documentation to use maps in my application. I am getting error "" I have tried everything but still am not able to resolve it.
Here's my MainActivity.java
package com.example.maps;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
This is the xml layout
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<TextView
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/header"
/>
</RelativeLayout>
This is the error I'm getting in logcat
02-02 16:02:46.110: E/AndroidRuntime(11094): FATAL EXCEPTION: main
02-02 16:02:46.110: E/AndroidRuntime(11094): Process: com.example.maps, PID: 11094
02-02 16:02:46.110: E/AndroidRuntime(11094): java.lang.RuntimeException: Unable to start activity ComponentInfo{http://ift.tt/1ePoX4P}: android.view.InflateException: Binary XML file line #22: Error inflating class fragment
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://ift.tt/nIICcg"
package="com.example.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<permission
android:name="com.example.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature"
></permission>
<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"/>
<!-- 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-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/gyan_logo"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.maps.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>
<fragment xmlns:android="http://ift.tt/nIICcg"
android:name="com.google.android.gms.maps.MapFragment"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBJ4S3tVGq4GWjgsuJ2zm0EAfUPN3yFKKA"/>
</application>
</manifest>
Please help me resolve this error.
No comments:
Post a Comment