views:

52

answers:

2

I know this question has been asked and answered before, but after following all the instructions, I'm still having the same problem: I have a MapView in my Android application but the view is only showing the underlying grid (and overlays), but not the map itself.

I am building the project in Eclipse, if that makes a difference.

I have the following AndroidManifest.xml file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication"
      android:versionCode="1"
      android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".MyApplication"
              android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
 <uses-library android:name="com.google.android.maps"></uses-library>

Then in my shell, I ran the following command: $ keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android

and got the following output: androiddebugkey, Sep 23, 2010, PrivateKeyEntry, Certificate fingerprint (MD5): DF:69:80:83:16:1A:F0:E9:B9:07:B9:BD:F7:BC:DB:61

I went to http://code.google.com/android/maps-api-signup.html and plugged the value DF:69:80:83:16:1A:F0:E9:B9:07:B9:BD:F7:BC:DB:61 into the form, and got the following API key: 0peT6kQ21Tpd1Rs61gBHHtquJwDcNeKkqedT08g.

My res/layout/main.xml file looks like this:

<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="0peT6kQ21Tpd1Rs61gBHHtquJwDcNeKkqedT08g" />

And my MyApplication.java file looks like: package com.example.myapplication;

import android.os.Bundle;

import com.google.android.maps.MapActivity;

public class MyApplication extends MapActivity {

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

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

I deployed the project using Eclipse, and my AVD is compatible with the Google API 2.1-update1. I checked to make sure that project is signed, and the command $ jarsigner -verify -verbose ~/workspace/MyApplication/bin/MyApplication.apk returns the following output:

sm      2200 Thu Sep 30 12:42:16 EDT 2010 res/drawable/icon.png
sm       676 Thu Sep 30 12:42:16 EDT 2010 res/layout/main.xml
sm      1796 Thu Sep 30 12:42:16 EDT 2010 AndroidManifest.xml
sm      1968 Thu Sep 30 12:42:16 EDT 2010 resources.arsc
sm      7816 Thu Sep 30 12:42:16 EDT 2010 classes.dex
         646 Thu Sep 30 12:42:16 EDT 2010 META-INF/MANIFEST.MF
         699 Thu Sep 30 12:42:16 EDT 2010 META-INF/CERT.SF
         776 Thu Sep 30 12:42:16 EDT 2010 META-INF/CERT.RSA

  s = signature was verified 
  m = entry is listed in manifest
  k = at least one certificate was found in keystore
  i = at least one certificate was found in identity scope

I've given the application on the AVD about ten minutes now to load the map images and I'm not getting anything. The adb logcat isn't reporting any exceptions:

I/ActivityManager(   56): Starting activity: Intent { cmp=com.example.myapplication/.MyApplication }
E/ActivityThread(  259): Failed to find provider info for com.google.settings
E/ActivityThread(  259): Failed to find provider info for com.google.settings
W/MapActivity(  259): Recycling dispatcher com.google.googlenav.datarequest.DataRequestDispatcher@43d1e3b8
V/MapActivity(  259): Recycling map object.
I/ActivityManager(   56): Displayed activity com.example.myapplication/.MyApplication: 376 ms (total 376 ms)

Can anyone figure out what I'm doing wrong here? Any advice would be appreciated. Thanks.

A: 

I shut down the emulator and restarted it, and now it's working fine. I notice that the new emulator has the "3G" symbol and the icon that shows the phone reception has two bars. (The old emulator didn't have either the 3G or 1G symbol, and it didn't have any bars.) Maybe that made a difference...?

jay
@jay: Yes, that makes a difference. When the emulator starts up, it tries to determine if you have an Internet connection at that time. If you do, it behaves normally, and you have the 3G icon with 2 bars of signal. If, however, the emulator does not detect an Internet connection, it will behave as though there is no connectivity at all (data or voice), and you will get 0 bars of signal. This will persist even if you clear up any Internet problems on the host computer. Rebooting the emulator is the only solution I know of. While in the 0-bars state, Internet access will not work.
CommonsWare
In my experience this is a bug with the emulator. I have internet access all the time but the emulator seems to want to start up without internet every now and then. Restarting it fixes it.
ShadowGod
+1  A: 

Add the internet permission to the manifest...

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