谷歌地圖不加載,並給出一個空白屏幕 嘗試了一些指南,並試圖谷歌的指導,但沒有一個似乎工作 這就是我全部有加,不可能發現一個問題: -/谷歌地圖2版不加載
logcat的:
06-27 01:21:16.470: I/Google Maps Android API(12628): Google Play services client version: 4452000
06-27 01:21:16.490: I/Google Maps Android API(12628): Google Play services package version: 4452036
06-27 01:21:16.790: D/dalvikvm(12628): GC_FOR_ALLOC freed 3003K, 16% free 17823K/21008K, paused 32ms, total 33ms
06-27 01:21:16.800: I/fpp(12628): Making Creator dynamically
06-27 01:21:16.800: I/Google Maps Android API(12628): Google Play services client version: 4452000
06-27 01:21:16.810: W/ActivityThread(12628): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
06-27 01:21:17.261: I/Google Maps Android API(12628): Failed to contact Google servers. Another attempt will be made when connectivity is established.
06-27 01:21:24.709: D/dalvikvm(12628): GC_FOR_ALLOC freed 3259K, 15% free 19643K/23084K, paused 40ms, total 40ms
06-27 01:21:32.367: E/Google Maps Android API(12628): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
Android清單:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionName="1.0.0"
android:versionCode="1"
package="com.sahaab.android.muslimzone.test" >
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" />
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="com.sahaab.android.muslimzone.test.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.sahaab.android.muslimzone.test.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-feature
android:name="android.hardware.location"
android:required="false" />
<uses-feature
android:name="android.hardware.location.network"
android:required="false" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature
android:name="android.hardware.wifi"
android:required="false" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDTkYW-kWs9VKB40pv7Qhw972blaz-GD1A" />
<activity
android:name="com.sahaab.muslimzone.activity.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop" >
<meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".activities.MyActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.sahaab.muslimzone.activity.InfoActivity"
android:label="@string/app_name"
android:launchMode="singleTop" >
<meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".activities.MyActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.sahaab.muslimzone.activity.IqamahActivity"
android:label="@string/app_name"
android:launchMode="singleTop" >
<meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".activities.MyActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
活性:
package com.sahaab.muslimzone.activity;
import com.sahaab.android.muslimzone.test.R;
import android.app.Activity;
import android.os.Bundle;
public class IqamahActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_iqamah);
}
}
佈局:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/iqamah_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
@ integer/google_play_services_version的價值是什麼? – justDroid
請檢查我的答案。 –
thnx,對不起我睡着了XD –