【发布时间】:2014-01-13 21:14:10
【问题描述】:
我在我的应用程序中按照sut up a Google Map 的所有步骤来创建调试密钥。 问题是,当我第一次使用 eclipse 在调试模式下运行应用程序时,一切正常,但后来如果我重新启动应用程序(不使用 eclipse,而是从我家),地图不再工作,甚至没有出现...它只显示一个灰色的页面。
我的清单
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar"
android:debuggable="true" >
<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="MY_KEY" />
我的代码
googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
// Check if we were successful in obtaining the map.
if (googleMap != null) {
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), zoom), 3000, null);
googleMap.clear();
MarkerOptions marker = new MarkerOptions().title(values[0]).snippet(values[1]).position(new LatLng(latitude, longitude));
googleMap.setInfoWindowAdapter(new Adapter_Marker(context));
googleMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker arg0) {
EDU.infosDialog(context, fieldNames, infos);
}
});
googleMap.addMarker(marker).showInfoWindow();
MY_LAYOUT
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/bar_messina" />
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
为什么????
【问题讨论】:
-
你能发布你的 Logcat
-
您要重新启动同一个应用程序还是导出 apk 文件?我的意思是,该应用程序仍处于调试模式?那么,如果你连接了你的设备,你能看到日志吗?
-
我还没有导出 .apk 文件... Eclipse 将它保存在我的手机上,然后当我拔下 USB 连接器时,地图不再起作用
标签: java android eclipse google-maps android-maps-v2