Android : Unfortunately google maps stopped

醉酒当歌 提交于 2019-12-11 08:20:02

问题


Main.xml & manifest.xml

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

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.Map.test"
    android:versionCode="1"
    android:versionName="1.0" >
     <application android:label="@string/app_name">
        <uses-library android:name="com.google.android.maps" />
        <activity android:name=".GoogleMaps" 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"/>
</manifest>

GoogleMaps.java

    import com.Map.test.R;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class GoogleMaps extends MapActivity {
private MapView mapView;
@Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mapView = (MapView) findViewById(R.id.map_view);       
    mapView.setBuiltInZoomControls(true);
    }
    @Override
    protected boolean isRouteDisplayed() {
    return false;
    }
}

Eclipse is not showing any error in my code and also emulator running but finally i'm getting "Unfortunately google maps stopped" error. May i know what is the problem in this code ?


回答1:


Have you tried a different API Key? I had the same problem a while back ago and I was using a debug key, I had to generate a new key and use that. I would try that first and see what happens.



来源:https://stackoverflow.com/questions/10383353/android-unfortunately-google-maps-stopped

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!