Search code examples
androidgoogle-mapsgoogle-maps-api-2api-key

Android Maps v2 Couldn't get connection factory client


I have a problem. I am getting a blank google map. I tried everything around the net. But nothing seems to solve this issue. I have pasted the logcat below. I have tried both debug key and release key. But both are not working. The map is not working. I just get a grey background with Google written below :( Please help

09-04 12:29:57.037: E/MapActivity(9569): Couldn't get connection factory client
09-04 12:29:57.067: D/dalvikvm(9569): GC_FOR_ALLOC freed 54K, 2% free 9295K/9464K, paused 14ms, total 14ms
09-04 12:29:57.637: W/System.err(9569): IOException processing: 26
09-04 12:29:57.637: W/System.err(9569): java.io.IOException: Server returned: 3
09-04 12:29:57.647: W/System.err(9569):     at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
09-04 12:29:57.647: W/System.err(9569):     at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
09-04 12:29:57.657: W/System.err(9569):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
09-04 12:29:57.657: W/System.err(9569):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
09-04 12:29:57.657: W/System.err(9569):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
09-04 12:29:57.657: W/System.err(9569):     at java.lang.Thread.run(Thread.java:841)

My XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView 
        android:id="@+id/textlat"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"/>
    <TextView 
        android:id="@+id/textlong"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"/>
    <com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="API Key"/>  

</LinearLayout>

My Manifest

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

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

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>
    <permission
    android:name="com.rrj.maps.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="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="com.rrj.maps.permission.MAPS_RECEIVE" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name="com.rrj.maps.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="API_KEY"/>
        <uses-library android:name="com.google.android.maps"/>
    </application>

</manifest>

[UPDATE]: I tried generating the sha1fingerprint again. I observed that the signature algorithm used is SHA256withRSA where as the example in the google dev site show SHA1withRSA could this be causing any problem?


Solution

  • In your XML file you are using pld Google Map API v1.. And in your Manifest file you have wrote code for Google Map V2.. SO just add this in xml replace with old.

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment"/>
    

    and yes also remove

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

    from manifest file....

    you can refer this also:

    Still Gets "Couldn't get connection factory client" Error

    android google map Couldn't get connection factory client