• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Google map is showing a blank page

subone

Lurker
Nov 4, 2014
4
0
Hello,

I am making an Android application in Eclipse that uses Google maps v2.

I was following this tutorial:

http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/
I have no errors in my code, and made everything that has to be made for Google map to show.
(Created API key in Google console, assigned SHA1 key, added permissions ....)

But I don't know why the map is showing this blank page:
http://i.imgur.com/xYLZRWr.jpg
I imported google-play-services library and appcompat_v7 and added them in my project properties.

Logcat: ( This is what it shows when I open the map activity)
Code:
12-01 21:39:50.749: D/REQUEST(5440): Error processing: com.google.maps.api.android.lib6.gmm6.n.o@4b0d1940 not retrying
12-01 21:39:50.759: D/REQUEST(5440): Add Data Request: 75
12-01 21:39:50.959: D/REQUEST(5440): Connection opened to:https://clients4.google.com/glm/mmap/api
12-01 21:39:50.959: D/REQUEST(5440): Open Connection
12-01 21:39:51.149: D/REQUEST(5440): DRD(1): 62|15|147
12-01 21:39:51.149: D/REQUEST(5440): Close
12-01 21:39:51.149: D/REQUEST(5440): Error processing: com.google.maps.api.android.lib6.b.d@4b2bc030 not retrying
12-01 21:39:51.149: D/REQUEST(5440): Retrying: com.google.maps.api.android.lib6.b.j@4b0d26a0
12-01 21:39:51.149: D/REQUEST(5440): Retrying: com.google.maps.api.android.lib6.c.au@4b134434
12-01 21:39:51.359: D/REQUEST(5440): Connection opened to:https://clients4.google.com/glm/mmap/api
12-01 21:39:51.359: D/REQUEST(5440): Open Connection
12-01 21:39:51.669: D/REQUEST(5440): DRD(2): 62|15|147
12-01 21:39:51.669: D/REQUEST(5440): Close
12-01 21:39:51.669: D/REQUEST(5440): Error processing: com.google.maps.api.android.lib6.b.d@4b2d1680 not retrying
12-01 21:39:51.669: D/REQUEST(5440): Retrying: com.google.maps.api.android.lib6.b.j@4b0d26a0
12-01 21:39:51.669: D/REQUEST(5440): Retrying: com.google.maps.api.android.lib6.c.au@4b134434
12-01 21:39:51.879: D/REQUEST(5440): Connection opened to:https://clients4.google.com/glm/mmap/api
12-01 21:39:51.879: D/REQUEST(5440): Open Connection
12-01 21:39:52.169: D/REQUEST(5440): DRD(3): 62|15|147
12-01 21:39:52.169: D/REQUEST(5440): Close
12-01 21:39:52.169: D/REQUEST(5440): Error processing: com.google.maps.api.android.lib6.b.d@4b1fbe90 not retrying

This is the Manifest XML code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.kickoff"
  android:versionCode="1"
  android:versionName="1.0" >
  <permission
  android:name="com.example.kickoff.permission.MAPS_RECEIVE"
  android:protectionLevel="signature" />
  <uses-permission android:name="com.example.kickoff.permission.MAPS_RECEIVE" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 
  <!-- Required to show current location -->
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <!-- Required OpenGL ES 2.0. for Maps V2 -->
  <uses-feature
  android:glEsVersion="0x00020000"
  android:required="true" />
 
  <uses-sdk
  android:minSdkVersion="11"
  android:targetSdkVersion="18" />
  <application
  android:allowBackup="true"
  android:icon="@drawable/appicon"
  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="AIzaSyCejLbmw4UjuGV-neJq8wNwQiKmgQpCQos" />
.
.
.
</application>
</manifest>

Location XML :
Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.kickoff.Location" >

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

Location Java code:

Code:
package com.example.kickoff;

import com.example.kickoff.R;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

//import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class Location extends FragmentActivity {

    // Google Map
    private GoogleMap googleMap;
  
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_location);
      
        try {
            // Loading map
            initilizeMap();
          
            googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
          
         // latitude and longitude
            double latitude = 17.385044;
            double longitude = 78.486671;
           
            // create marker
            MarkerOptions marker = new MarkerOptions().position
                    (new LatLng(latitude, longitude)).title("Hello Maps ");
          
            CameraPosition cameraPosition = new CameraPosition.Builder().target(
                    new LatLng(latitude, longitude)).zoom(12).build();
   
            googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
           
            // adding marker
            googleMap.addMarker(marker);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * function to load map. If map is not created it will create it for you
     * */
    private void initilizeMap() {
        if (googleMap == null) {
            googleMap = ((MapFragment) getFragmentManager().findFragmentById(
                    R.id.map)).getMap();
            // check if map is created successfully or not
            if (googleMap == null) {
                Toast.makeText(getApplicationContext(),
                        "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                        .show();
            }
        }
    }
  
    @Override
    protected void onResume() {
        super.onResume();
        initilizeMap();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.location, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

So how can I solve this problem ? :(
 
Last edited:

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones