仍然得到“无法获取连接工厂客户端”错误
10月4日至1日:17:20.701:E/MapActivity(377):无法获取连接工厂客户仍然得到“无法获取连接工厂客户端”错误
我得到的是灰瓦和地图不会被加载。
嘿,我知道每个人都有很多类似的职位,我彻底通过他们。
它可以是Internet的权限(我补充说,之前应用标签)或者
使用库机器人:名字=“com.google.android.maps”(由内应用标签)或
这是糟糕的API密钥。
以下是我之前创建的调试密钥和Google map api v1正确显示的地图,没有任何问题。 后来当我打开该项目它没有解决MapActivity,GeoPoint,MapController等..
所以我创建了另一个调试密钥,我现在在这个项目上使用,我再次检查我正确地跟着所有的步骤创建api。
这是(我创建一个新的调试旧)造成这个问题?我应该删除C:\ Users \ abc.android中的debug.keystore并调试项目以自动创建一个新的?它会解决问题还是会导致我更多的问题?
我一直在寻找一个解决方案,因为昨天我仍然有问题,请帮助我。如果需要任何代码请提前告诉您,让我知道我会发布它们。
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>
清单
<?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>
我猜你已经混一些的V1和V2的功能(如在清单和使用GeoPoint
等使用<uses-library android:name="com.google.android.maps" />
(https://groups.google.com/forum/?fromgroups=#!topic/android-developers/CGF5X1HMLuY)
尝试使用以下示例代码:
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));
}
地图。 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>
从清单中删除<uses-library android:name="com.google.android.maps" />
。
嗨thanx的答复我试着你的建议,但我得到“不能解决键入”错误'谷歌地图'&'SupportMapFragment'我没有添加谷歌播放服务_lib文件 - >进口 - >现有的android进入工作区和Project-> properties-> android-> add-> google-play-services_lib当我第一次添加库引用时,它显示出绿色的勾号符号,但是当我关闭它并再次转到Project-> properties-> android, play-services_lib显示为红色十字标记是否是问题? – I2Believe
是啊..我猜它没有正确导入。您应该引用复制到源代码树的库的副本,您不应该从Android SDK目录引用库(例如,在导入时将项目复制到工作区)。还需要为'SupportMapFragment'添加'google-support-v4'库。 –
google-support-v4.jar已经在lib文件夹中...我会再次尝试引用并让您知道谢谢。 – I2Believe
在模拟器中运行谷歌地图V2有几个步骤,所以我准备教程一步一步向您展示如何使用谷歌地图的Android V2上仿真器(安卓4.2.2)在我的博客看看:http://umut.tekguc.info/en/content/google-android-map-v2-step-step
您是否在API 2中使用调试密钥并在代码中使用MapActivity?如果您使用API 2,则可能还需要更新代码。在这里发布一些代码。 –
嗨@DivyaMotiwala感谢您的快速回复。是的,我之前使用Fragment来显示地图,并且我有一个关闭的力量,我知道我仍然可以使用地图查看并显示地图,因此我切换回使用mapActivity。 – I2Believe