2012-04-12 4 views
0

Mapview를 사용하여 두 도시 사이의 경로를 찾으려고합니다.Mapview가 안드로이드 장치에서 작동하지 않았습니다.

문제는 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> 
+0

문제가 해결 되었습니까? –

+0

예. 해결됨 –

답변

1

는 장치에 회색 격자 및 블록 대신지도를 받기는하지만, 시뮬레이터에서 잘 작동합니다.

다음 중 하나를

  1. 당신은 바로 앱 서명에 사용되는 서명 키를 사용하여 해당 레이아웃에서 apiKey, 또는

  2. 장치가 인터넷이없는이없는 액세스하거나 그렇지 않으면 Google의지도 타일 서버에 연결할 수 없습니다.

누락 된 INTERNET 권한이 될 수 있지만 그게있는 것처럼 보입니다.

+0

문제가 해결되었습니다. 애플리케이션의 APK에 서명하는 동안 MD5 지문으로 서명 된 키도 동일해야합니다. –

0

정상 ... "디버그"용 API 키는 에뮬레이터에서만 작동합니다. Eclise를 사용하여 소프트웨어를 "디버그 모드"로 핸드셋에로드하면 맵이 아닌 타일을 얻게됩니다. 지도보기를 '출시'API 키로 업데이트 한 다음 Eclipse 'EXPORT'를 사용하여 apk 파일을 만들고이를 휴대 전화의 sd 카드에 복사 한 다음 설치 프로그램 (Google Play에서 무료로 다운로드)을 사용하여 설치합니다 전화로 IT가 작동합니다 !!!

관련 문제