为什么图形页面显示灰瓦,而不是地图? [英] Why does MapView show grey tiles and not the map?

查看:170
本文介绍了为什么图形页面显示灰瓦,而不是地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好了,我通过创建一个批处理文件得到了我的SHA1指纹。在那之后,我去了服务页面,并启用了谷歌地图API v2和v3。我还去了API访问页面并创建与SHA1一个新的Andr​​oid按键; PACKAGENAME。在此之后,我去了我的项目文件夹,并添加了以下code:

Ok, so I got my SHA1 fingerprint by creating a batch file. After that, I went to the "Services" page and enabled Google Maps API v2 and v3. I also went to the "API Access" page and created a new Android Key with the SHA1;PACKAGENAME. After this, I went to my project folder and added the following code:

<permission
    android:name            = "com.example.test.permission.MAPS_RECEIVE"
    android:protectionLevel = "signature" 
/>

<uses-feature
    android:glEsVersion     = "0x00020000"
    android:required        = "true" 
/>

<uses-permission android:name="com.example.test.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<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-library android:name="com.google.android.maps" />

<meta-data
        android:name    = "com.google.android.maps.v2.API_KEY"
        android:value   = "APIKEY" 
/>

我还创建了一个XML文件,并粘贴以下code:

I also created an XML file and pasted the following code:

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
    xmlns:android           = "http://schemas.android.com/apk/res/android"
    android:id              = "@+id/mapview_MV"
    android:layout_width    = "fill_parent"
    android:layout_height   = "fill_parent"
    android:clickable       = "true"
    android:apiKey          = "APIKEY"
/>

上编译和我的HTC运行的项目后的一个X +,我看到没有什么比一群灰瓦多。我也试着使用code一个图形页面,如下图所示:

After compiling and running the project on my HTC One X+, I saw nothing more than bunch of grey tiles. I also tried to use a MapView in code as shown below:

/********************************************************************
* ONCREATE                                                          *
********************************************************************/
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView( R.layout.general_layout );

    MapView mapView = new MapView( GamePage.this, "APIKEY" );
    MapController mc = mapView.getController();
    String coordinates[] = {"1.352566007", "103.78921587"};
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    GeoPoint p = new GeoPoint( (int) (lat * 1E6), (int) (lng * 1E6) );

    mc.animateTo(p);
    mc.setZoom(17); 

    FrameLayout fl = ( FrameLayout ) findViewById(R.id.general_frameHolder_FL);
    fl.addView(mapView);
}

我能看到以下错误:

I get to see the following error:

Couldn't get connection factory client

谁能告诉我我在做什么是地狱的错!?

Can anyone tell me what the hell I'm doing wrong!?

推荐答案

我找到了解决问题的办法。我需要做的是删除谷歌播放服务在SDK管理器并重新安装它,因为我错过了很多出于某种原因包。感谢菲多,我发现图形页面没有在谷歌地图Android版V2 API的支持,并在阅读整个介绍:的https://developers.google.com/maps/documentation/android/start#specifying_permissions.

I found a solution for the problem. What I needed to do was delete the Google Play Services in the SDK Manager and reinstall it, because I missed lots of packages for some reason. Thanks to Fido, I found out that MapView isn't supported in Google Maps Android v2 API and read the whole introduction at: https://developers.google.com/maps/documentation/android/start#specifying_permissions.

在那之后,我也发现一个网站,你可以在解决NoClassFoundError:
<一href=\"http://www.user.tu-berlin.de/hennroja/tutorial_fixing_java.lang.NoClassDefFoundError%20com.google.android.gms.R\" rel=\"nofollow\">http://www.user.tu-berlin.de/hennroja/tutorial_fixing_java.lang.NoClassDefFoundError%20com.google.android.gms.R$styleable.html

After that, I also found a site where you can solve the NoClassFoundError at: http://www.user.tu-berlin.de/hennroja/tutorial_fixing_java.lang.NoClassDefFoundError%20com.google.android.gms.R$styleable.html

我花了+ - 5小时解决新的谷歌地图API这个该死的问题。

It took me +- 5 hours to solve this freaking issue with the new Google Maps API.

这篇关于为什么图形页面显示灰瓦,而不是地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆