0

Android google maps get error无法获取连接工厂客户端,我从这里获取了 apikey ,这是我的代码:

MainActivity.java

package com.haichal.map;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;

public class MainActivity extends MapActivity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }
}

主要的.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <com.google.android.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:enabled="true"
        android:clickable="true"
        android:apiKey="0IbdGeqd17e6zbTdNfSze2pEt1jJzEEPoOM0jZw"
        />

</RelativeLayout>

显现

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.haichal.map"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="15" />

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

    <application
        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=".MainActivity"
            android:label="@string/title_app" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

在 android 项目目标中,我使用 Google APIs, platform 4.1.2, Api level 16

在我的 Eclipse 项目中没有出现错误(没有红色气球),我调试并安装成功,但是当我运行应用程序时,地图只是得到空白网格,没有得到地图,如果我查看日志猫我得到消息错误无法连接工厂客户

如何解决我的问题?

4

1 回答 1

0

当我运行应用程序时,地图只是得到空白网格,而不是地图

您的设备无法访问 Internet(至少无法访问 Google 地图服务器),或者您的 API 密钥错误。另一种可能性是您缺乏INTERNET许可,但似乎您已经拥有许可。

如果我查看日志 cat 我收到消息错误无法获取连接工厂客户端

即使您的应用程序正常工作,该消息也会一直发生。

于 2013-01-21T14:45:30.793 回答