Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

googlemaps error log:api key not found

i created android key. i use the key in my code

<meta-data android:name="com.google.androoid.maps.v2.API_KEY"
android:value="AIzaSyDlSZf-YTqh_rBLyzjzB6VanBVm4xk6VvI"/>

but android can't found api key. i don't know this error cause.

01-15 15:12:33.526: E/AndroidRuntime(28834): Caused by: java.lang.RuntimeException: API key not found. Check that is in the element of AndroidManifest.xml

mannifest file '

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="17" />
<permission
    android:name="com.example.googlemap.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<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.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


<!--
The following two permissions are not required to use
Google Maps Android API v2, but are recommended.
-->


<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.example.googlemap.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>
    <meta-data android:value="4030500" 
                android:name="com.google.android.gms.version"/>
    <meta-data android:name="com.google.android.gms.version" 
                android:value="@integer/google_play_services_version"/>
    <meta-data android:name="com.google.androoid.maps.v2.API_KEY"
              android:value="AIzaSyDlSZf-YTqh_rBLyzjzB6VanBVm4xk6VvI"/>

</application>

</manifest>
'
like image 564
yoyoung Avatar asked Jan 15 '14 06:01

yoyoung


People also ask

How do I fix Invalid API key?

If you see an error message that reads ERROR: Invalid API key during checkout, follow these steps: Go to Wordpress > Printful > Settings. Delete the Printful Store API Key and click Save changes. Go to your Dashboard and click Connect.

Why is my API key not working?

API keys have multiple dependencies that can result in errors like: "The user is not authorized for this operation based on …". Please make sure you are using the correct credentials and endpoint with the correct API key.

How do I get the key for GeoCoding API?

Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key. Click Close.


3 Answers

Change this

 <meta-data android:name="com.google.androoid.maps.v2.API_KEY"   
          android:value="AIzaSyDlSZf-YTqh_rBLyzjzB6VanBVm4xk6VvI"/>
 // androoid should be android

to

<meta-data android:name="com.google.android.maps.v2.API_KEY"
          android:value="AIzaSyDlSZf-YTqh_rBLyzjzB6VanBVm4xk6VvI"/>

and remove

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

Also clean and build the project. If it does not work try regenerating the api key again

like image 69
Raghunandan Avatar answered Oct 19 '22 18:10

Raghunandan


use these line

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

instead of

<meta-data android:value="4030500" 
                android:name="com.google.android.gms.version"/>
    <meta-data android:name="com.google.android.gms.version" 
                android:value="@integer/google_play_services_version"/>
    <meta-data android:name="com.google.androoid.maps.v2.API_KEY"
              android:value="AIzaSyDlSZf-YTqh_rBLyzjzB6VanBVm4xk6VvI"/>
like image 45
Jitesh Upadhyay Avatar answered Oct 19 '22 16:10

Jitesh Upadhyay


In addition to the answers already given, I had a similar version of this problem and found a solution as follows.

I noticed that for some reason my google_maps_api.xml file in the values folder had been renamed google_maps_api.xml (w820dp). It appeared that in trying to rename the file it still appended the w820dp. I made a note of my api key and deleted the file entirely, adding a new version, which wasn't appended with w820dp. This fixed the problem.

like image 22
Gordonium Avatar answered Oct 19 '22 16:10

Gordonium