MapActivity could'nt get connection factory client

北慕城南 提交于 2020-01-06 15:44:07

问题


I've been looking for much on google about the problem, but I have not resolved. The map is displayed, but I located at the point where I want and still giving me the same failure:

06-09 12:10:57.231: I/MapActivity(1532): Handling network change notification:CONNECTED 06-09 12:10:57.231: W/IdleConnectionHandler(1532): Removing a connection that never existed! 06-09 12:11:04.829: W/KeyCharacterMap(1532): Can't open keycharmap file 06-09 12:11:04.829: W/KeyCharacterMap(1532): Error loading keycharmap file 06-09 12:11:04.829: W/KeyCharacterMap(1532): Using default keymap 06-09 12:11:57.080: I/MapActivity(1785): Handling network change notification:CONNECTED 06-09 12:11:57.080: E/MapActivity(1785): Couldn't get connection factory client

And I do not understand because I've followed all the steps to generate the api key, my Activity extends from MapActivity, and and I added my android manifiest permits and libraries.

Manifest.xml

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

        <uses-sdk android:minSdkVersion="10" />
        <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"/>


        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name" >
            <uses-library android:name="com.google.android.maps"/>                  
            <activity
                android:name=".MainActivity"
                android:label="@string/app_name" 
                android:theme="@android:style/Theme.NoTitleBar">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>    
            <activity android:name=".Activities.Gmaps"/>                
        </application>
    </manifest>

Gmaps Activity

import android.os.Bundle;

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

public class Gmaps extends MapActivity{

    private MapView mapa = null;
    private MapController control = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gmaps);                        

        mapa = (MapView)findViewById(R.id.mapa);
        mapa.setBuiltInZoomControls(true);

        Double latitud = 40.4166909;
        Double longitud = -3.7003454;

        GeoPoint loc = new GeoPoint(latitud.intValue(), longitud.intValue());

        control = mapa.getController();            
        control.setCenter(loc);
        control.setZoom(7);
    }

    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }

}

gmaps.xml

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

    <com.google.android.maps.MapView
        android:id="@+id/mapa"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="0htJ1gM0WymyYYokI3eUunfuJ2-XXXXXXXXX" 
        android:clickable="true"/>

</RelativeLayout>

Sorry for my english !! jeje :)


回答1:


Sign your application with a keystore and generate an apk for your application using this keystore.Then install this on your device. This would solve your problem.The map api key you are using must be generated with this keystore only.



来源:https://stackoverflow.com/questions/10960252/mapactivity-couldnt-get-connection-factory-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!