androidgoogle-mapsmapactivity

android app Couldn't get connection factory client


I am developing app for android and using MapActivity for google maps. But I am getting Error "Couldnt get connection factory client" . I explored several threads for this error, but couldnt get any satisfying answer. Here is my code:

Manifest.xml

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

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

<!--
      <permission
        android:name="wsu.cs558.roadmonitoring.view.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
-->

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<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="wsu.cs558.roadmonitoring.view.permission.MAPS_RECEIVE"/> -->

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MapViewActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

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

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

main.xml

<RelativeLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical" 
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">

 <com.google.android.maps.MapView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/map_view"
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent"
 android:clickable="true" 
  android:enabled="true" 
  android:apiKey="AIzaSyCyT7IoMyt5iqRAd2mhO2m50dBecCc59YI" />

 </RelativeLayout>

MapViewActivity.java

  package wsu.cs558.roadmonitoring.view;

 public class MapViewActivity extends MapActivity {

private MapView mapView;
private static final int latitudeE6 = 37985339;
private static final int longitudeE6 = 23716735;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    mapView = (MapView) findViewById(R.id.map_view);
    mapView.setBuiltInZoomControls(true);




}


@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}

}

I got the same error when I used in Emulator, so now I am using my mobile Device to run the app. I get same error. I am using Google API (2.3.3) for build target. Plz help.


Solution

  • Ok, I got the answer myself. But I really had to dig a lot. The problem was because of Google Map Api version. The code I have used works only with Api V1 which is deprecated. So, you have to either register your app under Version 1 and use that key in android manifest or use Fragment (version 2 android map code) to resolve this problem. I wish someone else had answered this before or in any other threads.

    Anyways Enjoy.