谷歌地图API V2显示空白的地图 [英] Google Maps API v2 shows blank map
问题描述
我已经建立了一个Android应用程序,以查看在谷歌地图的一些东西。我用谷歌地图API v2和遵循所有这些都可以在这里找到设置一>。我甚至用,我申请了谷歌的网站一键注册的应用程序。
我已经能够获得运行我打开它的活动,但每一次我看到一个空白屏幕。
I have set up an Android Application in order to view some things on a Google Map. I used the Google Maps API v2 and followed all the setup which can be found here. I even registered the application using a key that I applied for on Google's website.
I have been able to get the Activity running but every time I open it I am greeted with a blank screen.
这是我的清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.stullich.tim.woistmeinphoto"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission
android:name="com.stullich.tim.woistmeinphoto.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.stullich.tim.woistmeinphoto.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:required="true"
android:name="android.test.runner">
</uses-library>
<activity
android:name="com.stullich.tim.woistmeinphoto.PhotoGalleryActivity"
android:label="@string/app_name"
android:screenOrientation="landscape"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FullImageViewActivity"
android:screenOrientation="landscape" >
</activity>
<activity android:name=".MapViewActivity"
android:screenOrientation="landscape" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Excluded this for now" />
</application>
这是我的活动我在哪里载入地图
package com.stullich.tim.woistmeinphoto;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.SupportMapFragment;
public class MapViewActivity extends FragmentActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.map_view_activity);
SupportMapFragment fragment = new SupportMapFragment();
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, fragment).commit();
}
}
我听说没有使用可能会导致这个问题的正确API密钥,但我现在已经三检查钥匙,我不认为这是问题。
I have heard that not having the correct API Key used can lead to this problem, but I have triple-checked the key now and I don't think that is the issue.
推荐答案
在 Akhil 解决了这个问题,我也。
The Akhil solved the issue for me as well.
我使用OSX和debug.keystore位于 $ HOME / .android / debugkeystore
。为debug.keystore的密码是机器人正如在签名调试模式文档。您将需要执行密钥工具来获取SHA1串
I am using OSX and the debug.keystore is located in $HOME/.android/debugkeystore
. The password for the debug.keystore is 'android' as pointed in the Signing in Debug Mode documentation. You will need to execute keytool to get the SHA1 string
$> keytool -list -v -keystore .android/debug.keystore
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: androiddebugkey
Creation date: Mar 7, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 5138a42f
Valid from: Thu Mar 07 15:29:03 CET 2013 until: Sat Feb 28 15:29:03 CET 2043
Certificate fingerprints:
MD5: BA:3C:6D:7A:4C:4A:AD:3E:65:DB:53:D1:3A:23:A3:4D
SHA1: A5:38:93:50:7C:EA:55:22:51:1E:BC:EE:AA:A5:6D:A8:6C:B7:16:35
Signature algorithm name: SHA1withRSA
Version: 3
在谷歌API控制台你需要的SHA1串 A5:38:93:50:7C:EA:55:22:51:1E:BC:EE:AA:A5:6D:A8:6C:B7:16:35
In the Google APIs Console you would need the SHA1 string A5:38:93:50:7C:EA:55:22:51:1E:BC:EE:AA:A5:6D:A8:6C:B7:16:35
这篇关于谷歌地图API V2显示空白的地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!