没有谷歌地图API密钥对我有用

时间:2013-01-06 11:48:50

标签: android google-maps google-maps-api-3 google-api google-maps-api-2

我在debug.keystore和自定义密钥库中都使用了这两个键,但是我的地图上只显示了网格

这是我在开始地图活动时的日志输出

01-06 17:14:38.475: W/System.err(4391): IOException processing: 26
01-06 17:14:38.475: W/System.err(4391): java.io.IOException: Server returned: 3
01-06 17:14:38.482: W/System.err(4391):at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
    01-06 17:14:38.482: W/System.err(4391):at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
    01-06 17:14:38.482: W/System.err(4391):at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
    01-06 17:14:38.482: W/System.err(4391):at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
                                                at java.lang.Thread.run(Thread.java:1019)

2 个答案:

答案 0 :(得分:0)

这是我的manifest.xml

                                   <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bombil.aawaz"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />







<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- Creates a custom permission so only this app can receive its messages. -->
<permission
    android:name="com.bombil.aawaz.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.bombil.aawaz.permission.C2D_MESSAGE" />

<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<!-- Network State Permissions to detect Internet status -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- Permission to vibrate -->
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>



<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

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

    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name="com.bombil.aawaz.Registration"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
        android:screenOrientation="portrait"

    >
        <intent-filter>
            <action android:name = "com.bombil.aawaz." />
            <category android:name="android.intent.category.DEFAULT"/>


        </intent-filter>

    </activity>

    <activity
        android:name="com.bombil.aawaz.TraceLocation"
        android:label="@string/app_name"


    >
        <intent-filter>
            <action android:name = "com.bombil.aawaz.TraceLocation" />
            <category android:name="android.intent.category.DEFAULT"/>


        </intent-filter>

    </activity>

    <activity
        android:name="com.bombil.aawaz.HelpMe"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
       android:screenOrientation="portrait"
    >
        <intent-filter>
            <action android:name = "com.bombil.aawaz.HelpMe" />
            <category android:name="android.intent.category.DEFAULT"/>


        </intent-filter>

    </activity>

    <activity
        android:name="com.bombil.aawaz.HelpAlert"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
        android:screenOrientation="portrait"
    >
        <intent-filter>
            <action android:name = "com.bombil.aawaz.HelpAlert" />
            <category android:name="android.intent.category.DEFAULT"/>


        </intent-filter>

    </activity>

     <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" 
               android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.bombil.aawaz" />  
        </intent-filter>   
    </receiver>


    <service
        android:name=".GCMIntentService">
    </service>

    <activity
        android:name="com.bombil.aawaz.AlertWidget"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"

    >
        <intent-filter>
            <action android:name = "com.bombil.aawaz.AlertWidget" />
            <category android:name="android.intent.category.DEFAULT"/>


                     </intent-filter>

                  </activity>

                </application>




                  </manifest>

答案 1 :(得分:0)

在活动代码

中声明此内容
<activity ....... >
        ...
        ...
        <meta-data android:name="com.google.android.maps.v2.API_KEY"
                android:value="your_api_key"/>
</activity>