5

Android device only shows tiles for map. Seems to be widely reported. I followed the instructions of this link:

https://developers.google.com/maps/documentation/android/start

I did the following:

1) In Eclipse, I signed in Release Mode. I select File > Export. Selected Export Android Application, and clicked Next. Created a new keystore. Then uploaded the apk to google play.

2) Android app worked on device but map didnt show. It just showed tiles.

3) So I followed the instructions in the link above.

4) I located the keystore file that I created above. My keystore is called ziggy.keystore and alias is ziggy keystore.

5) I ran this in terminal on Mac OSX:

keytool -list -v -keystore ziggy.keystore -alias ziggy\ keystroke

6) The above command produces output that includes a line that contains the certificate's SHA-1 fingerprint. The fingerprint is the sequence of 20 two-digit hexadecimal numbers separated by colons.

7) Now that I have the signing certificate fingerprint, I created a project for the application in the Google APIs Console. In a browser, I navigated to https://code.google.com/apis/console/

8) I clicked Create Project. I named it API project. I see a list of APIs and services in the main window.

9) I scroll down until I see Google Maps Android API v2. To the right of the entry, I clicked the switch indicator so that it is on. I agreed to the terms of service and clicked accept.

10) In the left navigation bar, I clicked API Access. In the resulting page, I clicked Create New Android Key. In the resulting dialog, I entered the SHA-1 fingerprint, then a semicolon, then the application's package name.

11) I copied the API key. I opened my application's manifest, contained in the file AndroidManifest.xml. And add the following element as a child of the element, by inserting it just before the closing tag :

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

* Note that I used my real api key.

12) I added this as well:

<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"/>


<permission
      android:name="com.otl.AndroidRemoteApp1.permission.MAPS_RECEIVE"
      android:protectionLevel="signature"/>
    <uses-permission android:name="com.otl.AndroidRemoteApp1.permission.MAPS_RECEIVE"/>

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

13) Then in my ShowMapActivity.java:

    super.onCreate(savedInstanceState);
    setContentView(R.layout.show_map);
            mapView = (MapView) findViewById(R.id.mapview);

    myMapController = mapView.getController();  
    mapView.setBuiltInZoomControls(true);

    Drawable marker=getResources().getDrawable(android.R.drawable.star_big_on);
            ...

14) Then in my show_map.xml file:

<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:state_enabled="true" 
    android:apiKey="my_api_key"
/>

* I replaced my_api_key with the real key.

So I followed all the instructions and then when I downloaded the app on an android device, it did not show the map. It just shows the tiles thing, which has been reported before.

I'm not sure what step I missed to get this to work.

4

2 回答 2

1

配置步骤对我来说看起来不错。

但我认为你正在以一种老式的方式与图书馆互动。我知道文档说 MapView 可以添加和控制到活动中,但我会尝试使用新的GoogleMapMapFragment方法。我不确定库的 V2 对“扩展 MapActivity 和处理 MapView”的支持程度

这是它的文档:https ://developers.google.com/maps/documentation/android/map#add_a_map_to_an_android_application

你试过了吗?

于 2012-12-12T01:34:02.947 回答
0

感谢您非常详尽的描述。问题是您使用的是 Android v2 API 的设置过程 f,但使用的是 v1 API 中的类。由于现在不推荐使用 v1,因此强烈建议您使用 v2。如果您按照有关使用 Google Play 服务构建的其余说明进行操作,则应该没问题。

于 2012-12-12T07:52:33.040 回答