谷歌地图只显示空白瓷砖android

Google map displaying only blank tiles android(谷歌地图只显示空白瓷砖android)

本文介绍了谷歌地图只显示空白瓷砖android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的应用程序中实现了谷歌地图.但它只显示空白网格.我已经在 AndroidManifest.xml 文件中进行了更改,并且还在地图活动的布局文件中包含了 API 密钥.

I have implemented google map in my app.But its display only blank grids.I have done changes in AndroidManifest.xml file and also included API key in layout file of map activity.

推荐答案

这可能听起来很傻,但我一直遇到这个问题,直到我意识到 <uses-permission> 标签需要将子级引导到 <manifest> 元素,而不是 <application> 元素.我错误地将它们放在 <uses-library> 标记之后.所以你的 AndroidManifest.xml 文件的最终结构应该是这样的:

This may sound silly, but I kept encountering this problem until I realized that the <uses-permission> tags need to be direct children to the <manifest> element, rather than the <application> element. I had erroneously been putting them right after the <uses-library> tag. So the final structure of your AndroidManifest.xml file should be something like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
    <uses-sdk ... />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

    <application ... >
        <activity ... >
            <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>
</manifest>

希望这对犯同样错误的人有所帮助!

Hope this helps anyone who was making the same mistake!

这篇关于谷歌地图只显示空白瓷砖android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:谷歌地图只显示空白瓷砖android

基础教程推荐