【问题标题】:showing google map v2显示谷歌地图 v2
【发布时间】:2013-06-12 09:35:31
【问题描述】:

在运行 google map v2 时遇到致命异常,我确实导入了 google-play-service-lib 并从 google 制作一个 Api,而 mainfest 正在使用:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.getlocation"
    android:versionCode="1"
    android:versionName="1.0" >


<permission
        android:name="com.example.getLocation.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>

<uses-permission android:name="com.example.getlocation.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
     Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />


<uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>


    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.getlocation.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
 <activity android:name="com.example.getlocation.map"
                              android:screenOrientation="portrait"
            ></activity>    
    <meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="AIzaSyB7rXLp7f3cnZ0sdjqQnCQiPbiPpkNVmPc"/>
    </application>

</manifest>

地图布局xml是:

 <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:map="http://schemas.android.com/apk/res-auto"
        android:id="@+id/the_map"

        android:name="com.google.android.gms.maps.SupportMapFragment "
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

这是课堂活动:

包 com.example.getlocation;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class map extends FragmentActivity  {

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

手机运行的版本是2.3.6,

【问题讨论】:

  • 你可以发布堆栈跟踪
  • 在结束标签&lt;/application&gt;之前添加&lt;meta-data&gt;标签。
  • @divya 它也不起作用。
  • 有 mainactivity 按钮打开地图类,
  • file:///C:/Users/Amira/Desktop/mjh.png

标签: android google-maps google-maps-api-3 android-fragments


【解决方案1】:

尝试不同的代码

链接:http://www.vogella.com/articles/AndroidGoogleMaps/article.html

这里完全描述了关于 googlemap 的一件事,你总是记得你的 googlemap 不能在模拟器上显示它会在真实设备上运行,但是你应该首先在你的模拟器上测试它,如果没有发生错误,然后在真实手机上测试它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-03-14
    • 2014-05-01
    • 2014-11-08
    • 1970-01-01
    • 2013-04-16
    相关资源
    最近更新 更多