无法获得连接工厂客户端 - 与谷歌地图斗争 [英] Couldn't get connection factory client - fighting with Google Maps

查看:27
本文介绍了无法获得连接工厂客户端 - 与谷歌地图斗争的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

另一天,另一个问题,我终于设法在我的 android 应用程序上正确设置了谷歌地图,或者至少我认为我已经完成了,整个程序开始了,它甚至调用了应该打印"地图的类,但我唯一能看到的是一个带有谷歌标签的网格[在角落里].我检查了 dalvik 监视器和错误

another day another problem, I finally managed to set up correctly google maps on my android application, or at least I thought I've done it, the whole progam starts, it even call the class which should "print" a map, but the only thing I can see is a grid with google label on it [ in the corner ]. I've checked the dalvik monitor and the error

E/MapActivity(394):无法获得连接工厂客户端

E/MapActivity(394): Couldn't get connection factory client

发生.我在stackoverflow网站上发现我应该从dalvik监视器发送gps信号或类似的东西,我已经做到了.什么也没发生,我又拿到了 api 密钥,但没有任何变化.

occurs. I've find out on stackoverflow website that I should sent a gps signal or sth like this from dalvik monitor, and I've done it. Nothing happend, also I got the api key one more time, but nothing changed.

这里是map.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- This file is /res/layout/mapview.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" 
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/zoomin" 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
android:onClick="myClickHandler"
android:padding="12px" />
<Button android:id="@+id/zoomout" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="-"
android:onClick="myClickHandler" 
android:padding="12px" />
<Button android:id="@+id/sat" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="Satellite"
android:onClick="myClickHandler" 
android:padding="8px" />
<Button android:id="@+id/street" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="Street"
android:onClick="myClickHandler" 
android:padding="8px" />
<Button android:id="@+id/traffic" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="Traffic"
android:onClick="myClickHandler" 
android:padding="8px" />
<Button android:id="@+id/normal" 
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:text="Normal"
android:onClick="myClickHandler" 
android:padding="8px" />
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/mapview" 
android:layout_width="fill_parent"
android:layout_height="wrap_content" 
android:clickable="true"
android:apiKey="0zPcz1VYRSpLusufJ2JoL0ffl2uxDMovgpW319w" />
</LinearLayout>

这是一个 MapMapa.java

here is a MapMapa.java

public class MapMapa extends MapActivity
{
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
mapView = (MapView)findViewById(R.id.mapview);
}

public void myClickHandler(View target) {
switch(target.getId()) {
case R.id.zoomin:
mapView.getController().zoomIn();
break;
case R.id.zoomout:
mapView.getController().zoomOut();
break;
case R.id.sat:
mapView.setSatellite(true);
break;
case R.id.street:
mapView.setStreetView(true);
break;
case R.id.traffic:
mapView.setTraffic(true);
break;
case R.id.normal:
mapView.setSatellite(false);
mapView.setStreetView(false);
mapView.setTraffic(false);
break;
}
}
@Override
protected boolean isLocationDisplayed() {
return false;
}
@Override
protected boolean isRouteDisplayed() {
return false;
}

manifest.xml

manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="menu.dot" android:versionCode="1" ndroid:versionName="1.0">
<application android:label="@string/app_name" android:icon="@drawable/icon">
<uses-library android:name="com.google.android.maps" />
<activity android:name="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=".About">
android:label="@string/about_title" 
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity android:name=".Exit">
andorid:label="@string/exit_title"> 
</activity>
<activity android:name=".Options">
</activity>
<activity android:name=".Start">
</activity>
<activity android:name=".Create">
</activity>
<activity android:name=".Where">
</activity>
<activity android:name=".Proceed">
</activity>
<activity android:name=".Finish">
</activity>
<activity android:name=".Login">
</activity>
<activity android:name=".OK">
</activity>
<activity android:name=".UserPanel">
</activity>
<activity android:name=".Managero">
</activity>
<activity android:name=".Edition">
</activity>
<activity android:name=".Done">
</activity>
<activity android:name=".Delete">
</activity>
<activity android:name=".MapMapa">
</activity>

</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-sdk android:minSdkVersion="3" />
</manifest> 

推荐答案

E/MapActivity(394): Couldn't get connection factory client 

在您的情况下这不会成为问题.这只是警告信息.

This will not be issue in your case. It's just warning message.

使用 Map 需要注意的事项:

For using Map,things you need to Keep in mind :

1.在Manifest文件中添加网络权限

1.Add internet permission in Manifest file

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

2.在Manifest文件中添加库代码:

2.Add Library code in Manifest file :

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

  1. Extend Map Activity 而不是 Activity 还要确保您的 SDKGoogle 不是 Android

  1. Extend Map Activity instead of Activity also ensure that your SDK is Google not Android

然后使用 Release Key 而不是使用 Default Android Debug key 生成 Map Key检查此帖子以创建 使用 Release Key 的密钥.

Then generate Map Key using Release Key and not by using Default Android Debug key Check this post for creating Key using Release Key.

有关更多参考,请查看此链接 Mobi Forge

For further references check this link Mobi Forge

这篇关于无法获得连接工厂客户端 - 与谷歌地图斗争的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆