无法联系谷歌地图的服务器 [英] Failed to contact Google map servers
问题描述
我知道这已被要求,并回答了很多次,但尽管很多之后就在这里解决方案,我仍然无法突破这个错误:
无法加载地图。无法联系谷歌的服务器
我已经设置谷歌地图Android版API V2,并删除然后用新钥匙尝试之前重新生成debug.keystore但没有进一步向前发展。
任何想法,我缺少的是什么?
我的 activity_main.xml中
:
<片段的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:地图=http://schemas.android.com/apk/res-auto
机器人:ID =@ + ID / the_map
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:名字=com.google.android.gms.maps.SupportMapFragment
图:cameraTilt =45
图:cameraZoom =14
/>
清单:
<?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=com.abelsoul.androidmapproject
安卓版code =1
机器人:=的versionName1.0>
<用途-SDK
安卓的minSdkVersion =11
机器人:targetSdkVersion =17/>
<许可
机器人:名字=com.abelsoul.androidmapproject.permission.MAPS_RECEIVE
安卓的ProtectionLevel =签名/>
<使用许可权的android:NAME =com.abelsoul.androidmapproject.permission.MAPS_RECEIVE/>
<使用许可权的android:NAME =android.permission.INTERNET对/>
<使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/>
<使用许可权的android:NAME =android.permission.WRITE_EXTERNAL_STORAGE/>
<使用许可权的android:NAME =com.google.android.providers.gsf.permission.READ_GSERVICES/>
<使用许可权的android:NAME =android.permission.ACCESS_COARSE_LOCATION/>
<使用许可权的android:NAME =android.permission.ACCESS_FINE_LOCATION/> <用途特征
机器人:glEsVersion =0x00020000
机器人:要求=真/><应用
机器人:allowBackup =真
机器人:图标=@绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ AppTheme>
<活动
机器人:名字=com.abelsoul.androidmapproject.MainActivity
机器人:标签=@字符串/ APP_NAME>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
&所述;元数据
机器人:名字=com.google.android.maps.v2.API_KEY
机器人:值=xxxxxxxxxxxxxxxxxxxxxx/>
< /用途>
< /清单>
MainActivity:
包com.abelsoul.androidmapproject;进口android.os.Bundle;
进口android.support.v4.app.FragmentActivity;
进口android.view.Menu;公共类MainActivity扩展FragmentActivity {@覆盖
保护无效的onCreate(捆绑savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.activity_main);
}@覆盖
公共布尔onCreateOptionsMenu(菜单菜单){
//充气菜单;如果是present这增加了项目操作栏。
。getMenuInflater()膨胀(R.menu.main,菜单);
返回true;
}
如果您使用的不是3G数据计划WIFI,也许你需要添加的权限来访问无线网络的状态,如
<使用许可权的android:NAME =android.permission.ACCESS_WIFI_STATE/>
到您的清单文件。该行固定我的问题。
I know this has been asked and answered many times but despite following lots of solutions on here I still can't get past this error:
Failed to load map. Could not contact Google servers
I've set "Google Maps Android API v2" and deleted then regenerated the debug.keystore before trying with a new key but no further forward.
Any ideas what I'm missing?
My activity_main.xml
:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/the_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
map:cameraTilt="45"
map:cameraZoom="14"
/>
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abelsoul.androidmapproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<permission
android:name="com.abelsoul.androidmapproject.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.abelsoul.androidmapproject.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" >
<activity
android:name="com.abelsoul.androidmapproject.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxx" />
</application>
</manifest>
MainActivity:
package com.abelsoul.androidmapproject;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
If you use WIFI instead of a 3G data plan, maybe you need add the permission to access wifi state, such as
< uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
into your manifest file. This line fixed my issue.
这篇关于无法联系谷歌地图的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!