我的Android谷歌地图可以';t在完成所有设置后加载,请检查它

我的Android谷歌地图可以';t在完成所有设置后加载,请检查它,android,google-maps-android-api-2,Android,Google Maps Android Api 2,我已经检查了所有设置,但是它不能加载带有片段的地图,而是一个缩放小部件。它没有网格。我已经检查过钥匙了,但我认为没有问题。 下面是我的代码 <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/> <!-- TODO: Replace "com.example.hellomap" with your package name -->

我已经检查了所有设置,但是它不能加载带有片段的地图,而是一个缩放小部件。它没有网格。我已经检查过钥匙了,但我认为没有问题。 下面是我的代码

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

    <!-- TODO: Replace "com.example.hellomap" with your package name -->
    <permission
            android:name="com.example.hellomap.permission.MAPS_RECEIVE"
            android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.hellomap.permission.MAPS_RECEIVE"/>

    <!-- The following four permissions -->
    <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-feature
            android:glEsVersion="0x00020000"
            android:required="true"/>

    <application
            android:label="@string/app_name"
            android:icon="@drawable/ic_launcher">

        <uses-library android:name="com.google.android.maps" />

        <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="AIzaSyDQFrrAorDIMec2q4kcxO9Y4hanG8x1YI0"/>

        <activity
                android:name="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>
    </application>

</manifest>
    <TextView
        android:id="@+id/tv_location"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/tv_location"
        class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
舱单:

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

    <!-- TODO: Replace "com.example.hellomap" with your package name -->
    <permission
            android:name="com.example.hellomap.permission.MAPS_RECEIVE"
            android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.hellomap.permission.MAPS_RECEIVE"/>

    <!-- The following four permissions -->
    <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-feature
            android:glEsVersion="0x00020000"
            android:required="true"/>

    <application
            android:label="@string/app_name"
            android:icon="@drawable/ic_launcher">

        <uses-library android:name="com.google.android.maps" />

        <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="AIzaSyDQFrrAorDIMec2q4kcxO9Y4hanG8x1YI0"/>

        <activity
                android:name="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>
    </application>

</manifest>
    <TextView
        android:id="@+id/tv_location"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/tv_location"
        class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>

确保您已经在谷歌控制台上激活了android map v2 api。 通过在google控制台上输入正确的SHA1和包名,您已经创建了正确的android密钥。
尝试在物理设备上运行它。

确保已从SDK管理器安装“Google Repository”。他们从未在说明中提到过这一点,但这必须与Google Play Services SDK一起安装,才能使所有功能正常运行。

因为我在中国,访问Google server不方便。因此,我使用了一个代理,使网络可以访问谷歌,然后一切顺利。感谢大家的回复,特别感谢@Yazan给了我一个提示。

任何错误都会出现在logcat中…………一些错误,比如找不到com.google.settings的提供商信息和未知权限com.google.android.providers.gsf.permission.READ_GSERVICES包com.google.android.ears等等。知道如何使用吗github项目我在github上发布了谷歌地图示例抱歉,我是一个新手,不知道如何使用它是的,我已经仔细检查过了,现在唯一没有尝试过的方法是在物理设备上测试它,因为我的公司不允许将计算机与移动设备连接。谷歌播放服务必须在地图设备中。您必须在物理设备上运行它,因为google play服务将在该设备的后台运行。谢谢您回答我的问题。我已经解决了这个问题。这是由网络引起的。
    <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="17"/>

    <!-- TODO: Replace "com.example.hellomap" with your package name -->
    <permission
            android:name="com.example.hellomap.permission.MAPS_RECEIVE"
            android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.hellomap.permission.MAPS_RECEIVE"/>

    <!-- The following four permissions -->
    <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-feature
            android:glEsVersion="0x00020000"
            android:required="true"/>

    <application
            android:label="@string/app_name"
            android:icon="@drawable/ic_launcher">

        <uses-library android:name="com.google.android.maps" />

        <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="AIzaSyDQFrrAorDIMec2q4kcxO9Y4hanG8x1YI0"/>

        <activity
                android:name="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>
    </application>

</manifest>
    <TextView
        android:id="@+id/tv_location"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/tv_location"
        class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>