大约10个月前,我做了一个与谷歌地图相关的小项目。为了工作,我首先生成了MD-5并注册以获得我的API密钥。开放的项目在谷歌公司API-10。那次是成功的。
但最近,我发现虽然我获得了清单文件(互联网许可和谷歌地图)的权限,然后在.xml文件中修改,在main.java中扩展了MapActivity。我认为,对于未实现的方法,至少应该查看一张地图。由于没有错误,只有地图网格ase显示。这些网格可以放大,但没有地图。最后,遵循了一个教程,但在那里我没有发现错误,结果是一样的。没有地图。
我也不知道原因。提前谢谢。
package com.my.goog;
import com.google.android.maps.MapActivity;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Map extends MapActivity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
<?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="0N81shD3frjkFeIRFawvwgY7V9g391ZqFn6YI-A"
/>
<-- manifest-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.goog"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="15" />
<application
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=".Map"
android:label="@string/title_activity_map" >
<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" />
</application>`
发布于 2013-06-21 16:36:17
正如拉格哈南丹在他的评论中所说,你不能在Google v2中使用仿真器,如这里所解释的:Running Google Maps v2 on the Android emulator
但是,如果您收到一条错误消息,上面写着:
如果没有Google服务,这个应用程序将无法运行,这是你手机上缺少的。
您可以尝试以下问题,其中一些已经成功地使其工作:This app won't run unless you update Google Play Services (via Bazaar)
发布于 2014-04-28 07:38:30

https://stackoverflow.com/questions/17240126
复制相似问题