prakash ubhadiya
prakash ubhadiya

Reputation: 1271

Google Map not load in Android its give Errors

I am first time working with android map V2. I was added all Require Permission in AndroidManifest.xml file and also add my map key. I was import external map library and also install google play service in Emulator. my application cannot load MAPFRAGMENT.

when i am run my Appliction it's thorws erros in MAP_FRAGMENT my activity_mail.xml file is

 <?xml version="1.0" en`enter code here`coding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

My AndroidManifest.xml file is

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

    <uses-sdk
        android:minSdkVersion="12"
        android:targetSdkVersion="17" />

    <permission
        android:name="com.praakash.googlemapall.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.praakash.googlemapall.permission.MAPS_RECEIVE" />
    <uses-permission
        android:name="android.permission.INTERNET"
        android:required="true" />
    <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" >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="here I put my key" />

        <activity
            android:name="com.prakash.googlemapall.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>
    </application>

</manifest>

When I Run this app it's give errors are **

05-07 11:15:04.960: E/AndroidRuntime(22116): FATAL EXCEPTION: main
05-07 11:15:04.960: E/AndroidRuntime(22116): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.prakash.googlemapall/com.prakash.googlemapall.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment

05-07 11:15:04.960: E/AndroidRuntime(22116): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4323000 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

**

Upvotes: 0

Views: 172

Answers (2)

Sravana Sandhya
Sravana Sandhya

Reputation: 46

just replace the metadata tag with the following tag in your manifest file.

<meta-data android:name="com.google.android.gms.version" 
android:value="4323000" />

Once check the version code in manifest file of google-play-services library.

If it contains this line in the xml file

android:versionCode="4242000"

then change it into

android:versionCode="4323000"

Upvotes: 2

Illegal Argument
Illegal Argument

Reputation: 10338

You should extend FragmentActivity instead of Activity.

Upvotes: 0

Related Questions