0

i some strange trouble with GoogleMaps on Android(api10), i think i got every i need to show map on my activity screen but it appear blank(gray space with grid and zoom buttons). Heres my AndroidManifest, layout file and source of activity.

[update]i make another project just for map

AndroidManifest

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

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

<permission android:name="your.application.package.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="your.application.package.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<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="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" >


    <uses-library android:name="com.google.android.maps" />

    <activity
        android:name="pl.example.mapa.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="AIzaSyATooww6ZGs80CF_2Zyjc3OMj9igbFNu9k" />
</application>

layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

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

mainActivity source

package pl.example.mapa;

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

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;

public class MainActivity extends FragmentActivity {

private GoogleMap gMap;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //gMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapFragment)).getMap();
}
}

i cane add logs track due i cant run it on emulator

i bet its some little think i miss but after all search in this moment i have no idea whot is wrong.

Mariusz
  • 1,352
  • 1
  • 16
  • 31

3 Answers3

1

You need to add an API Key to your Manifest file.

1) Obtain your API Key (Good instructions here)

2) Add the following line to your Manifest file right before the end tag.

 <meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="your_api_key"/>
exxodus7
  • 562
  • 1
  • 9
  • 27
0

It looks like you're using Maps v1, I had this issue as well. The new API (v2), requires the API key to be stored in the android manifest and uses a different library. I found this tutorial very useful when moving from v1 to v2.

danielcooperxyz
  • 960
  • 1
  • 13
  • 28
0

It seems like you are mixing both API's of Google Maps services. Mostly you are using API v1 but this permissions is of API v2:

<permission
android:name="pl.mariusz.georeminder.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="pl.mariusz.georeminder.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

and might be the one that causing you problems.

I on the other hand would suggest you to move to API v2, as API v1 soon will be deprecated (if it isn't already), here is a blog post I wrote on how to integrate Google Map API V2 into your application:

Google Maps API V2

Emil Adz
  • 40,709
  • 36
  • 140
  • 187
  • 1
    @Mariusz, would you mind to update your question with current code, result and stack trace... so we will have more information then just: "i still get blank space..." – Emil Adz Mar 26 '13 at 14:38