简体   繁体   English

修复无法加载地图。 无法联系Google服务器。

[英]Fix the Failed to load map. Could not contact Google servers.

I am using the map functionality in my app.Whenever I run map in my app I got error ie 我在我的应用程序中使用地图功能。每当我在我的应用程序中运行地图时,我得到错误即

04-19 11:03:50.274: E/Google Maps Android API(23366): Failed to load map. Could not contact Google servers.

I have checked manifest file and code all is correct.And Google play service is also working in my android device. 我已经检查了清单文件和代码都是正确的。谷歌播放服务也在我的Android设备上工作。 I am running sample code of map same error I have got.But I am not understanding what is exact problem.Please suggest me how to fix that problem. 我正在运行地图的示例代码同样的错误我有。但我不明白究竟是什么问题。请建议我如何解决这个问题。 ` `

Have you adquire your map-key in Google Api Console using the package name of your project and your SH1 of the Keytore? 您是否使用项目的包名和Keytore的SH1在Google Api控制台中获取了地图密钥? If not, go to console and do it ;) You have to put this key in your Manifest, and the permissions required. 如果没有,请转到控制台并执行;)您必须将此密钥放在您的清单中,并且需要权限。

Normally this error happens when: 通常在以下情况发生此错误:

  • No valid map-key. 没有有效的地图密钥。
  • The key is not for your keystore. 密钥不适用于您的密钥库。
  • You forgot some permision. 你忘记了一些倾向。

===============Mini tutorial===================== ===============迷你教程=====================

  1. Download and install Google Play Services from SDKManager 从SDKManager下载并安装Google Play服务
  2. Go to Google Api Console 转到Google Api控制台
  3. On your left, Create new Project (Give the name you want) 在左侧,创建新项目(提供您想要的名称)
  4. Know in the "services" option is allowed, so go inside the option. 知道“服务”选项是允许的,所以进入选项内部。
  5. Turn On Google Maps Android API v2 启用Google Maps Android API v2
  6. Know in click on "Generate new Android Key" in the page showed 知道点击显示的页面中的“生成新的Android密钥”
  7. You will need your SHA1 from the Keystore and the name of the project package Ex: 48:+4: ... :46;com.xxxx.xxx.xxx 您需要来自Keystore的SHA1和项目包的名称Ex: 48:+4: ... :46;com.xxxx.xxx.xxx
  8. To know your sha1 you have to open a CMD and do: 要了解你的sha1,你必须打开一个CMD并执行:

     C:\\>cd C:\\Users\\YOURUSER\\.android\\ C:\\Users\\YOURUSER\\.android>"C:\\Program Files\\Java\\jdkXXXX\\bin\\keytool.exe" -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android 

    XXX Means the version you have XXX表示您拥有的版本

  9. Now you got your api key go to your Manifest have to put: 现在你得到你的api密钥去你的Manifest必须放:

    ... ... ......

  10. Select the project, right click, go to "File/Import/Android/Existing Android Code into Workspace". 选择项目,右键单击,转到“文件/导入/ Android /现有Android代码到工作区”。 In the root directory go to "<-sdk-android folder> /extras/google/google_play_services/libproject/google-play-services_lib" and select the project that appears. 在根目录中,转到"<-sdk-android folder> /extras/google/google_play_services/libproject/google-play-services_lib"并选择出现的项目。 Click Finish. 单击完成。

  11. Right click on project go to "Properties/Android"; 右键单击项目转到“属性/ Android”; click on "Add.." button, and choose google play services and click on OK 点击“添加..”按钮,然后选择Google Play服务并点击“确定”

  12. Add android-support-v4.jar to your project if isn't yet. 如果还没有,请将android-support-v4.jar添加到您的项目中。

  13. THe layout of the map is: 地图的布局是:

  14. And the activity that contains the map has to extend FragmentActivity (Something like this) 包含地图的活动必须扩展FragmentActivity(像这样的东西)

    public class MainActivity extends android.support.v4.app.FragmentActivity {

      @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } ... } 
  15. AAAAND thats all! AAAAND就是这样!

您是否使用密钥库和软件包名称为应用程序生成了api密钥?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “无法加载地图。 无法联系Google服务器。“ - “Failed to load map. Could not contact Google servers.” 授权失败。 无法加载地图。 无法联系Google服务器。 (适用于Android的Google Map) - Authorization failed. Failed to load map. Could not contact Google servers. (Google Map for Android) Google Maps android中的错误“android无法加载地图。 无法联系Google服务器。“ - Error in Google Maps android “android Failed to load map. Could not contact Google servers.” 无法加载地图。 无法联系Google服务器 - Failed to load map. Could not contact Google servers 无法加载地图。 无法联系Google服务器 - Failed to load map. Could not contact Google servers Android地图:无法加载地图。 无法联系Google服务器 - Android Maps: Failed to load map. Could not contact Google servers Google Maps API V2&#39;无法加载地图。 无法联系Google服务器 - Google Maps API V2 'Failed to Load Map. Could not contact Google Servers' Android版Google地图。 无法加载地图。 无法联系Google服务器 - Google Maps for Android. Failed to load map. Could not contact Google servers Google Maps Android API v2:无法加载地图。 无法与Google服务器联系 - Google Maps Android API v2: Failed to Load Map. Could not contact Google Servers “无法加载地图。 与Google服务器联系时出错。” 1台电脑出现问题 - “Failed to load map. Error contacting Google servers.” problems with 1 pc
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM