0

私はAndroid Googleマップの初心者です。いくつかのチュートリアルに従って開始しましたが、エラーが発生しています。エミュレーター (samsung galaxy 2) でGoogle マップを表示できません。以下にすべてのコードを書きました。エラーについて教えてください。

マニフェスト.xml

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

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="18" />
<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"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.examp.onemap.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <uses-library android:name="com.google.android.maps" />
</application>

</manifest>

MainActivity.java

package com.examp.onemap;

import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class MainActivity extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);   
    MapView mapView = (MapView) findViewById(R.id.mapView);
    mapView.setBuiltInZoomControls(true);
}

@Override
protected boolean isRouteDisplayed() {
    return false;
}

}

https://code.google.com/apis/console/からキーを生成しました

main.xml

<?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"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="AIzaSyDXwNWYXS9Lz9d-bJlodc1GELulHsalkT0"/>
4

3 に答える 3

0

V2 に変更した場合は、次のことが役立ちます。

Android エミュレーターで Google マップ v2 を実行する

うまくいけば ;)

于 2013-08-29T06:43:27.843 に答える
0

コーディングは Google マップ v1 です。Google マップ v2 に切り替えます。

ドキュメントはこちら

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

チュートリアルは

http://www.vogella.com/articles/AndroidGoogleMaps/article.html

于 2013-08-29T06:35:04.387 に答える
0

まず第一に、両方の Google Maps API を混在させています。API V2 キーのように見えるので、Google Maps API V1 オブジェクトとコードを使用しようとしています。これは決してうまくいきません。したがって、最初に行う必要があるのは、コードを API V2 コードに変更することです。そのために私が書いたこのチュートリアルに従うことができます:

Google マップ API V2

コードを API V2 コードに変更しても、エミュレータでは動作しません。最初に Google Play Services API をインストールしないと、エミュレータで Google Maps API V2 を実行できないためです。

于 2013-08-28T23:42:59.193 に答える