Google Maps V2 API清单问题。

时间:2015-05-08 03:28:31

标签: android xml google-maps manifest

我在使用V2谷歌地图让我的清单正确无法解决问题。 i cat当前正在接收的log cat中的错误是:

`java.lang.SecurityException: The Maps API requires the additional following permissions to be set in the AndroidManifest.xml to ensure a correct behaviour:
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>`

现在我尝试了很多不同的事情来实现这个目标,但到目前为止,我还没有成功。如果有人想看看我的清单并帮助我,我将不胜感激。

   <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.examples.test.night" >
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <!-- Open GL for Google Maps -->

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="***********************"/>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

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

        <!-- Creating Permission to receive Google Maps -->
        <permission
            android:name="com.examples.test.night.MAPS_RECEIVE"
            android:protectionLevel="signature" />

        <uses-permission android:name="com.examples.test.night.permission.MAPS_RECEIVE" />
        <uses-permission android:name="android.permission.WAKE_LOCK" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.CALL_PHONE" />
        <uses-permission android:name="android.permission.READ_PHONE_STATE" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.READ_PHONE_STATE" />
        <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>
        <activity
            android:name=".MainActivity2Activity"
            android:label="@string/title_activity_main_activity2" >
        </activity>
    </application>

</manifest>

再次感谢任何可以提供帮助的人。

1 个答案:

答案 0 :(得分:2)

<uses-permission>代码必须位于<application>代码之外。