Neil Walker
Neil Walker

Reputation: 6848

Google maps v2 white screen only see zoom. It used to work

I'm getting a white screen on my google maps app - zoom buttons are showing. I'm revisiting code I wrote last year that worked fine so it should all be ok. I'm testing on a gingerbread 2.3.3 phone.

  1. I have google maps v2 enabled
  2. I have a matching api key in my manifest: AIzaSyCKzmEns8anNV3QLLBRIw3f88Y7TmsXXXX
  3. I have the correct hash/domain in use for my debug:

    D6:35:00:83:CD:F6:2F:69:44:FB:D2:9E:AE:DE:F0:1B:27:01:1D:FF;com.example.androidac_session8a
    
  4. In my project I have google-play-services-lib linked

  5. I have the google APIs SDK downloaded and set as the target

  6. In my code I check that a googlemap object is returned, which it is and inside logcat there are no errors generated

  7. My manifest is ok as far as I know:

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="19" />
    
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    
    <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="com.example.androidac_session8a.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.gms.version"
        android:value="@integer/google_play_services_version" />
    
        <meta-data android:name="com.google.android.maps.v2.API_KEY" 
            android:value="AIzaSyCKzmEns8anNV3QLLBRIw3f88Y7TmsXXXX"/>
        </application>
    

  8. My layout is inside a tabbed view but here is the xml:

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

  9. Here is the code to initialise the map. I have additional code to update it to show satellite and draw stuff but I've removed that.

    private void initialiseMap() {
        //get the fragment and call getMap on it which returns a GoogleMap
        if (googleMap == null) {
              googleMap = ((SupportMapFragment) getFragmentManager().findFragmentById(
                    R.id.worldmap)).getMap();
    
            // check if map is created successfully or not
            if (googleMap == null) {
                Toast.makeText(activity.getApplicationContext(),
                        "Unable to create maps", Toast.LENGTH_SHORT)
                        .show();
            }
        }       
    }
    

Upvotes: 0

Views: 788

Answers (3)

D V Ramana
D V Ramana

Reputation: 1176

I had a similar problem but I doubt you would have the same problem but anyways give it a try . I set the default LatLng to zoom to at the start of the map to (0,0) and a very high zoom level . so I was seeing a desert at a high zoom level which seemed like map didn't load at all.

So try zooming out of the map or try explicitly setting the latLng and zoom level at the start of the map.

Upvotes: 0

Neil Walker
Neil Walker

Reputation: 6848

It's so bad I could cry ;)

I went on holiday and turned off packet data.

I have wifi on but at work my wifi hotspot is flaky at best yet wifi stays on but does nothing.

I enabled packet data and it worked.

3 hours I've spent reinstalling eclipse, google play library, regenerating keys....

Upvotes: 0

Md. Monsur Hossain Tonmoy
Md. Monsur Hossain Tonmoy

Reputation: 11085

debug keystore may expire within 1 year. Though there is no fix time limit. As you told that your code is one year old, so i think your key has expired. So better create new apikey. And usually white screen problem is occurred for wrong api key.

Open your terminal and execute the following command to generate SHA-1 fingerprint.

On Windows

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

On Linux or Mac OS`

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

and using this SHA-1 fingerprint create new api key

Upvotes: 2

Related Questions