我遵循了所有在线解决方案,但是没有任何改变,我仍然不断在地图上看到灰色瓷砖,而且地图不起作用......
教程指定我需要使用 MD5 指纹的 api 密钥,但是谷歌代码不接受它,而是需要 SHA-1 指纹......
这是我的代码:
主.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;
}
}
主要.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 上开发(旧教程)
请帮助