How to set api key for Google maps v2

NewUser

I am trying to create a map application. I am setting up the AndroidManifest.xml file for the permissions and API Key.

This is my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.dibya.map"
    android:versionCode="1"
    android:versionName="1.0" >

    <permission
        android:name="com.dibya.map.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

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

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="18" />
    <!-- Permissions needed -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.dibya.map.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:name="com.google.android.maps.v2.API_KEY"
            android:value="KEY" />
    </application>
</manifest>

I am getting an error message:

Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0.

You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

I have entered the correct API key. Please tell me where am I making mistake.

TNR

add the below tag inside your application tag and it works.

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

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Google Maps V2 - API key not found Error Message

分類Dev

Google Maps Android API v2

分類Dev

How to manage Markers well using google maps api v2 on android

分類Dev

Google Maps Android API v2 Authorization failure

分類Dev

Can't connect to Google Maps Api Android V2

分類Dev

Overlay an image on google maps android api v2

分類Dev

How to download and use offline maps in Map API V2?

分類Dev

Google Maps API key not used

分類Dev

How to change Language on Android google map V2 api

分類Dev

Android 2.3およびgoogle maps API v2

分類Dev

Android Google Maps API v2:方位位置を取得する

分類Dev

displaying Google Maps API v2 on real device/emulator. can't figure out error

分類Dev

Google Maps V2 APIマニフェスト、問題。

分類Dev

IOS-ObjC Google Maps API Key

分類Dev

How to animate the camera to a specified location in Google Maps v2 for Android?

分類Dev

Google android maps api v2マーカータイトルを常に表示

分類Dev

Google Maps API v2を使用したViewPager:不思議な黒いビュー

分類Dev

Animated Transparent Circle on Google Maps v2 is NOT animating correctly

分類Dev

Google maps v2 not displayed on new activity

分類Dev

Google Maps Activity V2 Android Studio

分類Dev

android maps api v2 adding multiple circles

分類Dev

How can I get current zoom level from Google Map Api v2?

分類Dev

Missing api_key/current key with Google Services 3.0.0 and Maps API key in build.gradle

分類Dev

Missing api_key/current key with Google Services 3.0.0 and Maps API key in build.gradle

分類Dev

Google Maps API エラー: MissingKeyMapError, but I have a key

分類Dev

IBM Worklight - How to use Google Maps API

分類Dev

Google Map API V3 - infowindows @ markers on 2 maps

分類Dev

Google Maps Android API v2のMapFragmentにカスタムコントロールを追加する方法

分類Dev

Google Maps API v2:マーカーをクリック可能にする方法は?

Related 関連記事

  1. 1

    Google Maps V2 - API key not found Error Message

  2. 2

    Google Maps Android API v2

  3. 3

    How to manage Markers well using google maps api v2 on android

  4. 4

    Google Maps Android API v2 Authorization failure

  5. 5

    Can't connect to Google Maps Api Android V2

  6. 6

    Overlay an image on google maps android api v2

  7. 7

    How to download and use offline maps in Map API V2?

  8. 8

    Google Maps API key not used

  9. 9

    How to change Language on Android google map V2 api

  10. 10

    Android 2.3およびgoogle maps API v2

  11. 11

    Android Google Maps API v2:方位位置を取得する

  12. 12

    displaying Google Maps API v2 on real device/emulator. can't figure out error

  13. 13

    Google Maps V2 APIマニフェスト、問題。

  14. 14

    IOS-ObjC Google Maps API Key

  15. 15

    How to animate the camera to a specified location in Google Maps v2 for Android?

  16. 16

    Google android maps api v2マーカータイトルを常に表示

  17. 17

    Google Maps API v2を使用したViewPager:不思議な黒いビュー

  18. 18

    Animated Transparent Circle on Google Maps v2 is NOT animating correctly

  19. 19

    Google maps v2 not displayed on new activity

  20. 20

    Google Maps Activity V2 Android Studio

  21. 21

    android maps api v2 adding multiple circles

  22. 22

    How can I get current zoom level from Google Map Api v2?

  23. 23

    Missing api_key/current key with Google Services 3.0.0 and Maps API key in build.gradle

  24. 24

    Missing api_key/current key with Google Services 3.0.0 and Maps API key in build.gradle

  25. 25

    Google Maps API エラー: MissingKeyMapError, but I have a key

  26. 26

    IBM Worklight - How to use Google Maps API

  27. 27

    Google Map API V3 - infowindows @ markers on 2 maps

  28. 28

    Google Maps Android API v2のMapFragmentにカスタムコントロールを追加する方法

  29. 29

    Google Maps API v2:マーカーをクリック可能にする方法は?

ホットタグ

アーカイブ