谷歌地图只显示空白瓷砖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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)