我知道这个问题之前已经被问及回答,但在按照所有说明操作之后,我仍然遇到同样的问题:我的Android应用程序中有一个MapView,但视图仅显示底层网格(和覆盖),但不是地图本身。Android谷歌地图不显示
我在Eclipse中构建项目,如果这有所作为。
我有以下的AndroidManifest.xml文件
<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>
然后在我的壳,我跑以下命令: $ keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android
,并得到了以下的输出: androiddebugkey, Sep 23, 2010, PrivateKeyEntry, Certificate fingerprint (MD5): DF:69:80:83:16:1A:F0:E9:B9:07:B9:BD:F7:BC:DB:61
我去了http://code.google.com/android/maps-api-signup.html并将值DF:69:80:83:16:1A:F0:E9:B9:07:B9:BD:F7:BC:DB:61
填入表格中,并得到以下API密钥:0peT6kQ21Tpd1Rs61gBHHtquJwDcNeKkqedT08g
。
我RES /布局/ main.xml中的文件看起来是这样的:
<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" />
而且我MyApplication.java文件看起来像: 包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;
}
}
我部署使用Eclipse的项目,我的AVD与谷歌API 2.1 UPDATE1兼容。我检查,以确保该项目的签署,并$ jarsigner -verify -verbose ~/workspace/MyApplication/bin/MyApplication.apk
返回下面的输出命令:
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
我给的AVD的应用大约有10分钟时间来加载地图图像和我没有变任何东西。该adb logcat
没有报告任何异常:
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 [email protected] V/MapActivity( 259): Recycling map object. I/ActivityManager( 56): Displayed activity com.example.myapplication/.MyApplication: 376 ms (total 376 ms)
任何人都可以找出我在做什么错在这里?任何意见,将不胜感激。谢谢。
您是否使用Google API版本运行模拟器,而不是正常版本?你的模拟器有互联网连接吗?谷歌地图应用程序的工作? – Falmarri 2010-09-30 17:26:20
是的,这是Google API,而不是普通版本。我不确定如何测试AVD的互联网连接。但我看了一下地图应用程序 - 一些地图被加载。如果我滚动浏览地图,我会看到地图,但是如果我向上,向下,向左或向右滚动得太远,我只能看到下面的网格(它不会加载地图的其余部分)。 – jay 2010-09-30 17:42:40