开发者

Google Map only showing Grey Blocks on load - Debug Cert has been obtained

I am attempting to follow the Google Map View under the views tutorial for the Android. I have followed step by step but still only see grey blocks when viewed.

First: I created a Virtual Device using "Google API's(Google Inc.) Platform 2.2 API Level 8" Second: When creating my project I selected "Google API's Google Inc. Platform 2.2 API Level 8". Third: I obtained the SDK Debug Certificate Fouth: Began Coding. Main.xml

<?xml version="1.0" encoding="utf-8"?> 
<com.google.android.maps.MapView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/mapview" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:clickable="true" 
android:apiKey="0l4sCTTyRmXTNo7k8DREHvEaLar2UmHGwnhZVHQ" 

/>

开发者_Python百科HelloGoogleMaps.java

package com.example.googlemap;
import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.MapView;
import com.google.android.maps.MapActivity;

public class HelloGoogleMaps extends MapActivity 
{
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main);
}

@Override 
protected boolean isRouteDisplayed() { 
    return false; 
}

}

HelloGoogleMaps Manifest:

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

  android:versionCode="1"
  android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">

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

    <activity android:name=".HelloGoogleMaps" 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>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 

 </manifest> 

Any thoughts??

Thanks!


You might try moving your permissions up earlier in your XML -- see here for a sample manifest that works on Android 2.1 and earlier (have not yet tried it on 2.2).

Also, make sure your emulator actually has Internet access. You should see a "3G" icon in the status bar with two bars of signal strength. If, instead, you have no bars and an "X" in the icon, then the emulator failed to detect an Internet connection when you started it up, and so it emulates having no connectivity.

You might also wish to try opening the regular Maps application and see if it works on your emulator. If it does not, then there may be firewall issues that are blocking your access to the map tile server.


The API Key is wrong. Do the debug.keystore extract once again - here it is for your convenience:

"C:\Program Files (x86)\Java\jre6\bin\keytool.exe" -list -alias androiddebugkey -keystore "c:\Users\user\\.android\debug.keystore" -storepass android -keypass android

Change user to your username on Windows of course.

I had the same problem until I re-did my API key.

It should work :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜