谷歌地图只显示空白的砖机器人只显示、空白、地图、砖机

2023-09-12 09:53:50 作者:没感情就绝交吧。

我已经实现了谷歌地图在我app.But它仅显示为空白grids.I做改变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.

推荐答案

这听起来可能很傻,但我一直遇到这个问题,直到我意识到<使用-许可> 标签必须是直接带孩子到<舱单> 元素,而非<应用> 元素。我曾错误地把他们的&LT之后,使用库> 标记。所以,你的Andr​​oidManifest.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!

 
精彩推荐