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

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

问题描述

另外一天另外一个问题,我终于成功地正确设置谷歌在我的Andr​​oid应用程序映射,或者至少我以为我已经做到了,整个编程'开始,它甚至调用类应打印地图,但我可以看到的唯一的事情是与谷歌的标签就可以了[在角落里]的网格。我检查了Dalvik的监测和错误

  

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

发生。我已经找到了对计算器的网站,我应该Dalvik的显示器发出的GPS信号或某事像这样,我已经做到了。没有什么happend,也给我的API密钥一次,但没有任何改变。

下面是map.xml

 < XML版本=1.0编码=UTF-8&GT?;
<! - 这个文件是/res/layout/mapview.xml  - >
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:方向=横向
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT>
<按钮机器人:ID =@ + ID / zoomin
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文本=+
机器人:的onClick =myClickHandler
机器人:填充=12px的/>
<按钮机器人:ID =@ + ID / zoomout
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文本= - 
机器人:的onClick =myClickHandler
机器人:填充=12px的/>
<按钮机器人:ID =@ + ID / SAT
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文本=卫星
机器人:的onClick =myClickHandler
机器人:填充=8像素/>
<按钮机器人:ID =@ + ID /街
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文本=街
机器人:的onClick =myClickHandler
机器人:填充=8像素/>
<按钮机器人:ID =@ + ID /交通
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文本=交通
机器人:的onClick =myClickHandler
机器人:填充=8像素/>
<按钮机器人:ID =@ + ID /正常
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:文本=正常
机器人:的onClick =myClickHandler
机器人:填充=8像素/>
< / LinearLayout中>
< com.google.android.maps.MapView
机器人:ID =@ + ID /图形页面
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:可点击=真
机器人:apiKey =0zPcz1VYRSpLusufJ2JoL0ffl2uxDMovgpW319w/>
< / LinearLayout中>
 

下面是一个MapMapa.​​java

 公共类MapMapa扩展MapActivity
{
私人图形页面图形页面;
@覆盖
保护无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.map);
图形页面=(图形页面)findViewById(R.id.mapview);
}

公共无效myClickHandler(查看目标){
开关(target.getId()){
案例R.id.zoomin:
。mapView.getController()zoomIn();
打破;
案例R.id.zoomout:
。mapView.getController()zoomOut();
打破;
案例R.id.sat:
mapView.setSatellite(真正的);
打破;
案例R.id.street:
mapView.setStreetView(真正的);
打破;
案例R.id.traffic:
mapView.setTraffic(真正的);
打破;
案例R.id.normal:
mapView.setSatellite(假);
mapView.setStreetView(假);
mapView.setTraffic(假);
打破;
}
}
@覆盖
保护的布尔isLocationDisplayed(){
返回false;
}
@覆盖
保护的布尔isRouteDisplayed(){
返回false;
}
 

manifest.xml的

 < XML版本=1.0编码=UTF-8&GT?;
<舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
包=menu.dot安卓版code =1ndroid:VERSIONNAME =1.0>
<应用机器人:标签=@字符串/ APP_NAME机器人:图标=@可绘制/图标>
<使用库机器人:名称=com.google.android.maps/>
<活动机器人:名称=MainActivity
机器人:标签=@字符串/ APP_NAME>
<意向滤光器>
<作用机器人:名称=android.intent.action.MAIN/>
<类机器人:名称=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>

< /活性GT;
<活动机器人:名称=关于>
机器人:标签=@字符串/ about_title
机器人:主题=@安卓风格/ Theme.Dialog>
< /活性GT;
<活动机器人:退出NAME =>
Andorid的:标签=@字符串/ exit_title>
< /活性GT;
<活动机器人:选项NAME =>
< /活性GT;
<活动机器人:名称=开始>
< /活性GT;
<活动机器人:名称=创建>
< /活性GT;
<活动机器人:去哪儿名字=>
< /活性GT;
<活动机器人:名称=继续>
< /活性GT;
<活动机器人:名称=完成>
< /活性GT;
<活动机器人:登录NAME =>
< /活性GT;
<活动机器人:OKNAME =>
< /活性GT;
<活动机器人:名称=。UserPanel>
< /活性GT;
<活动机器人:名称=。Managero>
< /活性GT;
<活动机器人:版NAME =>
< /活性GT;
<活动机器人:名称=完成>
< /活性GT;
<活动机器人:名称=删除>
< /活性GT;
<活动机器人:名称=。MapMapa>
< /活性GT;

< /用途>
<使用-权限的Andr​​oid:名称=android.permission.ACCESS_FINE_LOCATION/>
<使用-权限的Andr​​oid:名称=android.permission.ACCESS_COARSE_LOCATION/>
<使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>
<使用-SDK安卓的minSdkVersion =3/>
< /舱单>
 

解决方案

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

在你的情况下,这不会是问题。这只是警告信息。

有关使用地图,你需要要记住的事情:

在清单文件1.增加网络的权限

 <使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>
 

2.添加库code清单文件:

 <使用库机器人:名称=com.google.android.maps/>
 

  1. 延长地图活动,而不是活动也确保您的 SDK 谷歌不是Android的

  2. 然后用产生图例释放键而不是使用默认的Andr​​oid调试键 检查这个岗位创建<一个href="http://stackoverflow.com/questions/7728460/how-to-sign-an-android-app-for-the-market/7728587#comment9403046_7728587">Key使用释放键。

有关进一步的参考检查此链接摩比锻造

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): Couldn't get connection factory client

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.

here is 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>

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

<?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.

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

1.Add internet permission in Manifest file

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

2.Add Library code in Manifest file :

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

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

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

For further references check this link Mobi Forge

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

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