2013-07-08 134 views
0

當谷歌地圖API v2突然停止工作時,一切都很好。經過整整一天一夜的嘗試後,我仍然無法將它帶回來。我做了一個簡單的應用程序,但它仍然不起作用。谷歌地圖API v2突然停止工作

我的文件如下:

package com.azimbunafar.apps.japanallthingsdirectory; 

import android.os.Bundle; 
import android.support.v4.app.FragmentActivity; 

    public class MapActivity extends FragmentActivity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_map); 
    } 
} 

佈局文件是

<?xml version="1.0" encoding="utf-8"?> 
<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/map" 
    android:name="com.google.android.gms.maps.SupportMapFragment" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

清單文件是:

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

    <uses-sdk 
     android:minSdkVersion="10" 
     android:targetSdkVersion="17" /> 

    <permission 
     android:name="com.azimbunafar.apps.japanallthingsdirectory.permission.MAPS_RECEIVE" 
     android:protectionLevel="signature" /> 

    <uses-permission android:name="com.azimbunafar.apps.japanallthingsdirectory.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" /> 
    <!-- 
    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" /> 

    <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" > 

     <meta-data 
      android:name="com.google.android.maps.v2.API_KEY" 
      android:value="AIzaSyCzxLRmQvoRhtxVKHcaPAacknQfJVtXSoQ" /> 

     <activity 
      android:name="com.azimbunafar.apps.japanallthingsdirectory.MapActivity" 
      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> 

我在logcat中得到的錯誤是

07-08 12:28:29.114: D/dalvikvm(12232): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp 
07-08 12:28:29.114: W/dalvikvm(12232): VFY: unable to resolve instance field 27 
07-08 12:28:29.114: D/dalvikvm(12232): VFY: replacing opcode 0x52 at 0x0012 
07-08 12:28:29.114: D/dalvikvm(12232): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z 
07-08 12:28:29.394: D/dalvikvm(12232): GC_CONCURRENT freed 209K, 45% free 3134K/5639K, external 0K/0K, paused 6ms+26ms 
07-08 12:28:29.954: D/dalvikvm(12232): GC_CONCURRENT freed 350K, 45% free 3332K/5959K, external 0K/0K, paused 2ms+7ms 
07-08 12:28:30.365: D/dalvikvm(12232): GC_CONCURRENT freed 334K, 43% free 3539K/6151K, external 0K/0K, paused 2ms+4ms 
07-08 12:28:30.435: D/libEGL(12232): loaded /system/lib/egl/libGLES_android.so 
07-08 12:28:30.455: D/libEGL(12232): loaded /system/lib/egl/libEGL_adreno200.so 
07-08 12:28:30.455: W/SchedPolicy(12232): add_tid_to_cgroup failed to write '' (Invalid argument); background=0 
07-08 12:28:30.465: D/libEGL(12232): loaded /system/lib/egl/libGLESv1_CM_adreno200.so 
07-08 12:28:30.475: D/libEGL(12232): loaded /system/lib/egl/libGLESv2_adreno200.so 
07-08 12:28:30.585: D/dalvikvm(12232): GC_EXTERNAL_ALLOC freed 24K, 43% free 3548K/6151K, external 0K/0K, paused 50ms 
07-08 12:28:31.056: D/dalvikvm(12232): GC_CONCURRENT freed 280K, 42% free 3663K/6279K, external 235K/512K, paused 2ms+3ms 
07-08 12:28:31.216: I/Google Maps Android API(12232): Failed to contact Google servers. Another attempt will be made when connectivity is established. 
07-08 12:28:31.606: E/Google Maps Android API(12232): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors). 

我已經搜索「無法加載地圖的每一個線程。錯誤接觸谷歌的服務器」的錯誤,但似乎沒有任何工作。

我會明白任何一種解決方案或建議。如果您需要了解我的應用程序的更多信息,請讓我知道。

+0

你檢查的API密鑰?你混的SHA1由於切換,Google API控制檯中的按鍵會被屏蔽tween debug.keystore和您的簽名密鑰庫? –

+0

是的,我做到了。現在我正在使用我使用eclipse生成的degub.keystore和我自己的密鑰中的SHA1。似乎沒有任何工作。所有我看到的是一個白色的屏幕zoomin zoomout按鈕:(我甚至嘗試舊鑰匙是工作。 –

+0

嘗試徹底刪除應用程序,並重新安裝它再次。 – ddewaele

回答

1

您應該檢查您的許可,我有同樣的問題,那是因爲我刪除了一個許可。一定要在清單所有這些權限。

<uses-permission android:name="com.example.adroidtest.permission.MAPS_RECEIVE" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.CAMERA" /> 
<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" /> 
<!-- 
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" /> 

希望它可以幫助你。