04-01 10:17:20.701:E/MapActivity(377):无法获取连接工厂客户端
我得到的只是灰色瓷砖,并且地图未加载。
嘿,我认识的每个人都有很多类似的帖子,我彻底浏览了它们。
它可以是互联网权限(我在应用程序标签之前添加了该权限),或者
use-library android:name="com.google.android.maps" (添加到应用程序标签内)或
这是错误的 API 密钥。
这是我之前创建的调试密钥,Google 地图 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>
Manifest
<?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>