0

Mapview を使用して 2 つの都市間の経路を見つけようとしています。

問題は、Mapview が機能しないことです。デバイスのみでマップの代わりに灰色のグリッドとブロックを取得しますが、シミュレーターでは正常に機能します。

これが私のマニフェストです

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.MapDirection"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >

       <uses-library android:name="com.google.android.maps" />

    <activity
        android:label="@string/app_name"
        android:name=".MapDirectionActivity" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />

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


</application>

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

</manifest> 

これが私のレイアウトです:

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

<com.google.android.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="xxxxxxxxxxxxxxxxxxxxxx"
/>

 </LinearLayout>
4

2 に答える 2

1

デバイスのみでマップの代わりに灰色のグリッドとブロックを取得しますが、シミュレーターでは正常に動作します。

また:

  1. apiKeyアプリの署名に使用した署名キーに対応する権限がレイアウトにない、または

  2. お使いのデバイスはインターネットにアクセスできないか、Google のマップ タイル サーバーにアクセスできません

(3 番目の可能性は、INTERNETアクセス許可がないことですが、それはあるようです)

于 2012-04-12T13:54:28.773 に答える
0

わかりました...「デバッグ」の API キーは、エミュレーターでのみ機能します。Eclise を使用してソフトウェアを「デバッグ モード」でハンドセットにロードすると、マップではなくタイルが表示されます。「リリース」API キーでマップビューを更新する場合は、Eclipse の「EXPORT」を使用して apk ファイルを作成し、これをハンドセットの sd カードにコピーしてから、インストーラー アプリ (Google Play から無料でダウンロード) を使用してインストールします。電話で IT WORKS!!!

于 2013-02-06T12:00:41.947 に答える