我正在为 android 开发应用程序并将 MapActivity 用于谷歌地图。但我收到错误 "Couldnt get connection factory client" 。我为此错误探索了几个线程,但无法得到任何令人满意的答案。这是我的代码:
清单.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="wsu.cs558.roadmonitoring.view"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<!--
<permission
android:name="wsu.cs558.roadmonitoring.view.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
-->
<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" />
<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="wsu.cs558.roadmonitoring.view.permission.MAPS_RECEIVE"/> -->
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MapViewActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCyT7IoMyt5iqRAd2mhO2m50dBecCc59YI" />
</application>
主要的.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:enabled="true"
android:apiKey="AIzaSyCyT7IoMyt5iqRAd2mhO2m50dBecCc59YI" />
</RelativeLayout>
MapViewActivity.java
package wsu.cs558.roadmonitoring.view;
public class MapViewActivity extends MapActivity {
private MapView mapView;
private static final int latitudeE6 = 37985339;
private static final int longitudeE6 = 23716735;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.map_view);
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
我在模拟器中使用时遇到了同样的错误,所以现在我正在使用我的移动设备来运行该应用程序。我得到同样的错误。我正在使用 Google API (2.3.3) 作为构建目标。请帮忙。