-1

My Problem is When App connect to Google Map APi V2 The Map Not load It connected Without any error but map not loaded The Zoom Buttom appears but.....

Please Help Me

If Do you have Any Simale Code For me to use it Please Give it to me Thanks

It's manifest.xml

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

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="16" />

    <permission 
    android:name="com.example.maps.permission.MAP_RECEIVE"
    android:protectionLevel="signature"/>

<uses-permission android:name="com.example.maps.permission.MAP_RECEIVE"/>
<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.googel.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


<uses-feature android:glEsVersion="0x0002000"
    android:required="true"/>



<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >


    <activity
        android:name=".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.geo.API_KEY"
        android:value="[edited]"/>

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


</application>

It's The Xml File

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

And It's MainActivity

package com.example.maps;

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;

public class MainActivity extends FragmentActivity {

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

}

2 Answers2

0

You sure the meta-data name is "com.google.android.geo.API_KEY" and not "com.google.android.maps.v2.API_KEY". Could you please check once.

Jayesh Elamgodil
  • 1,467
  • 11
  • 15
0

Make sure to use this in your manifest.xml

<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="YOUR_KEY_HERE" />

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

You use com.google.android.geo.API_KEY, instead of com.google.android.maps.v2.API_KEY

UPDATE

Your MainActivity doesn't seem to load a map. A simple example looks like this:

private GoogleMap mMap;

if (mMap == null) {
        // Try to obtain the map from the SupportMapFragment.
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                .getMap();
        // Check if we were successful in obtaining the map.
        if (mMap != null) {
            Location locationdefault = new Location("NewYork");
            locationdefault.setLatitude(41.145495);
            locationdefault.setLongitude(−73.994901);

}
charoup
  • 31
  • 1
  • 9
  • Are you using Android Studio, or Eclipse? – charoup May 22 '15 at 15:25
  • You should consider using Android Studio, it is now the official IDE for Android. I think Eclipse can't recognize the 2 meta-data tags. – charoup May 22 '15 at 16:15
  • I Want But Android Studio Is Beta Version Yet – Milad Khaleghi May 22 '15 at 16:32
  • I'm using version 1.2. It gets updates very often and it's absolutely stable, not beta.It's easier than Eclipse.You can't use Google Play Services features with Eclipse anymore without dealing problems! – charoup May 22 '15 at 16:55
  • Ok Thanks.I didn't know the stable version is Available – Milad Khaleghi May 24 '15 at 11:50
  • I try that with Android Studio But it's Not Worked :-( – Milad Khaleghi May 25 '15 at 15:36
  • Well, many things could be wrong...I suggest you search around Stackoverflow.I had problems too, but I did it eventually!Just create a simple Google Maps Activity with Android Studio.Search around for a simple tutorial and you will make it! You could start here.. [Stackoverflow](http://stackoverflow.com/questions/16596715/how-can-i-create-an-android-application-in-android-studio-that-uses-the-google-m) – charoup May 26 '15 at 15:28