Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map

StackOverflow https://stackoverflow.com/questions/22637193

Question

I am trying to load a google map on screen.

I Googled it and tried all possible ways, but the screen shows a white screen and getting authorization failure error in logcat.

I have added Google play services to the project. Created an API key and added in manifest file. but can not understand where I did wrong.

My manifest file:

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="19" />

<permission
    android:name="com.pgi.root.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<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="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.pgi.routviewer.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

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

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.pgi.routviewer.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>

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

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyC3-blwKU7GgsARUaPNPXXVOMZPvixetKk" />
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" >
    </meta-data>
</application>

Please help me...

Was it helpful?

Solution

Just noticed an error in your manifest file. You use a permission named "com.pgi.routviewer.permission.MAPS_RECEIVE" but defined the permission like this:

<permission
android:name="com.pgi.root.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />

You should probably change it to:

<permission
android:name="com.pgi.routviewer.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top