Reputation: 2406
I'm trying to port an existing, working Google Maps App from API V1 to V2. I followed the directions on developers.google.com scrupulously but still no joy. The problem is that "API key not found" according to LogCat. The LogCat output is below:
05-04 11:46:55.882: E/AndroidRuntime(15175): Caused by:ava.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your API key"/>
is in the <application> element of AndroidManifest.xml
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.maps.api.android.lib6.d.fb.a(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.maps.api.android.lib6.a.g.a(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.maps.internal.i.onTransact(SourceFile:62)
05-04 11:46:55.882: E/AndroidRuntime(15175): at android.os.Binder.transact(Binder.java:380)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.maps.internal.zzc$zza$zza.zzk(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.maps.MapFragment$zzb.zztD(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.maps.MapFragment$zzb.zza(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.dynamic.zza.zza(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
05-04 11:46:55.882: E/AndroidRuntime(15175): at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2130)
05-04 11:46:55.882: E/AndroidRuntime(15175): at android.app.Activity.onCreateView(Activity.java:5610)
05-04 11:46:55.882: E/AndroidRuntime(15175): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:740)
05-04 11:46:55.882: E/AndroidRuntime(15175): ... 19 more
But it is there: My Manifest is below (API key is mutilated for this post):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ramrod.GoogleMapV2"
android:versionCode="100"
android:versionName="1.00">
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17"
/>
<uses-feature
android:glEsVersion="0x0020000"
android:required="true"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFU_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="android.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.MAPS_RECEIVE" />
<application
android:icon="@drawable/icon"
android:label="GoogleMapV2"
android:allowBackup="false">
<activity android:name=".GoogleMapV2Main"
android:label="GoogleMapV2">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<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="AIzaSyC0T6B0VEcEALyQi3WXXXXXXXXXXXXXXXX"
/>
</application>
</manifest>
I've been beating my head against the wall for almost a week with no joy. I've searched StackOverflow and the web: lot's of people with API key problems but almost universally with syntax problems. Unless I've gone XML-blind, I don't think that's my problem.
Anybody see something that I'm missing?
Upvotes: 0
Views: 1679
Reputation: 2353
I don't know if it could be the main reason but you have
<meta-data android:name="com.google.android.maps.V2.API_KEY" android:value="your API key"/>
where the V2 is with upper V and the logcat is saying to put it with lower v
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyC0T6B0VEcEALyQi3WXXXXXXXXXXXXXXXX" />
Upvotes: 3
Reputation: 3972
You have two types of Keys, one for debug sessions and other to publish your apks.
For a Debug Keystore you can get the SHA1 value in Eclipse.
Accessing from the menu: Window -> Preferences -> Android -> Build
Probably you are using the wrong SHA1 value.
Try to put the values directly in the manifest. Don't use @integer....
Upvotes: 0