Still Gets “Couldn't get connection factory cl

2019-02-20 14:51发布

04-01 10:17:20.701: E/MapActivity(377): Couldn't get connection factory client

All I get is gray tiles and the map doesn't get loaded.

Hey everyone I know there are lots of similar posts I did thoroughly go through them.

It can be Internet permission (I added that before application tag ), Or

uses-library android:name="com.google.android.maps" (Added inside application tag ) or

it's bad API Key.

Here's the thing I earlier created a debug key and Google map api v1 displayed map correctly with no problem. Later when i opened that project it didn't resolve MapActivity,GeoPoint,MapController etc..

so I created another debug key which I'm using now on this project and I double checked I followed all the steps correctly when creating api.

Is this(me creating a new debug over old) causing this problem? Should I delete the debug.keystore in C:\Users\abc.android and debug the project to automatically create a new? would it solve the problem or will it lead me to more problems?

I've been searching for a solution since yesterday I still have the problem please help me.Thank you so much in advance if any code is needed let me know I'll post them.

MActivity.java

package com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;


import android.os.Bundle;

public class MActivity extends MapActivity {


    MapController mControl;
    GeoPoint GeoP;
    MapView mapV;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map);

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

        double lat = 6.796396;
        double longi = 79.877823;

        mControl = mapV.getController();

        GeoP = new GeoPoint((int)( lat * 1E6 ),(int)( longi * 1E6 ));
        mControl.animateTo(GeoP);
        mControl.setZoom(13);


    }

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

}

map.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/layoutbg"
    android:orientation="vertical" >

   <com.google.android.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="AIzaSyCy32DkrrrrT-UBhoT8xiAW182qUaAqi3s"
        android:enabled="true"
        android:clickable="true" />

</RelativeLayout>

Manifest

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

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


     <permission
          android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.permission.MAPS_RECEIVE"
          android:protectionLevel="signature"/>
        <uses-permission android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.permission.MAPS_RECEIVE"/>


    <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-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>    



    <application
        android:allowBackup="true"
        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="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.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>


        <activity
            android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.MenuActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.KCLOGO" />

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


        <activity
            android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.AddFromContactsActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.ADDFROMCONTACT" />

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


        <activity
            android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.MActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.MAPS" />

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


        <activity
            android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.LoginActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.LOGIN" />

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


        <activity
            android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.SignupActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.SIGNUP" />

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


        <activity
            android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.AddToContactsActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.Aws0mEKCkreaTi0ns.GlobAlpSystracKerKC.ADDTOCONTACTS" />

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

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

    </application>



</manifest>

3条回答
\"骚年 ilove
2楼-- · 2019-02-20 15:34

Running google map v2 on emulator has several steps, so I prepared step by step tutorial to show how you can use google map android v2 on emulator(android 4.2.2) have a look at to my blog: http://umut.tekguc.info/en/content/google-android-map-v2-step-step

查看更多
时光不老,我们不散
3楼-- · 2019-02-20 15:35

I guess you have mixed some of V1 and V2 features (like using <uses-library android:name="com.google.android.maps" /> in manifest and use of GeoPoint etc. (https://groups.google.com/forum/?fromgroups=#!topic/android-developers/CGF5X1HMLuY)

Try with the sample code below :

MActivity.java

   public class MActivity extends FragmentActivity{

private GoogleMap map;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);

        map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                .getMap();

        double lat = 6.796396;
        double longi = 79.877823;
        final LatLng HAMBURG = new LatLng(lat,longi);
        Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
                .title("Hamburg"));
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));


    }

Map.xml

   <RelativeLayout 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"
tools:context=".MapsActivity" >

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />
  </RelativeLayout>

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

查看更多
何必那么认真
4楼-- · 2019-02-20 15:42

Actually I've been adding a different project's .jar file & This helped me to correctly add a external .jar to the project.Now I don't get "unresolved type" error.. Thank you everyone for pointing me to the correct direction you people are awesome.

查看更多
登录 后发表回答