我照着所有的在线解决方案,但是没有什么变化,我仍然不断收到地图和地图不工作的青瓦......谷歌地图视图只显示灰瓦
的教程规定,我需要一个API - 使用MD5指纹钥匙,但谷歌代码犯规接受它,而是它需要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的和IM即时通讯上的API 8(旧教程)
PLZ帮助发展中国家
的API_KEY是在XML布局,因为它是指示通过教程 –
@Tharwat请查看我上面链接的教程,其V2实现和一步一步的教程。在Google控制台上选择正确的API时请小心。 – Dporem