1

私はすべてのオンラインソリューションに従いましたが、何も変わりません。マップ上に灰色のタイルが表示され続け、マップが機能しません...

チュートリアルでは、MD5 フィンガープリントを使用する API キーが必要であると指定されていますが、Google コードはそれを受け入れず、代わりに SHA-1 フィンガープリントが必要です...

これが私のコードです:

Main.java:

package com.thenewboston.googleMaps;


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


public class Main extends MapActivity{

MapView map;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    map = (MapView)findViewById(R.id.mvMain);
    map.setTraffic(true);

    if(map.isShown()){
        System.out.println("Test1");
    }

    map.setBuiltInZoomControls(true);
    map.setSatellite(true);
}

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

Main.xml:

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


<com.google.android.maps.MapView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="AIzaSyAms_xsUt-l-qlIR6fuAd0jfaYRsBIV3bg"
        android:id="@+id/mvMain"
        />
</LinearLayout>

マニフェスト:

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

<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


<application android:label="@string/app_name">
    <uses-library android:name="com.google.android.maps"/>
    <activity
            android:name="Main"
            android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

</application>
</manifest> 

:LinuxとIntellij Ideaを使用しており、API 8で開発しています(古いチュートリアル)

PLZヘルプ

4

2 に答える 2

0

不足しているものがたくさんあることがわかります(マニフェストのAPIキーなど)

http://www.vogella.com/articles/AndroidGoogleMaps/article.htmlを確認してください。それは役立つかもしれません。私はこれがより良いhttp://www.youtube.com/watch?v=awX5T-EwLPc

于 2013-08-01T00:31:22.560 に答える