2013-01-09 281 views
6

我正在嘗試在我的Android應用程序中使用Google Drive。目前,我只是試圖在谷歌驅動器上顯示文件名。我使用本教程https://developers.google.com/drive/quickstart-android在我的應用程序中設置谷歌驅動器帳戶,並使用此https://developers.google.com/drive/v2/reference/files/list來檢索文件列表。GooglePlayServices因錯誤而不可用2

爲了做到這一點,我不得不創建一個異步任務:

private class getCloudContentTask extends AsyncTask<Void, Void, Void> { 

    protected void onPostExecute() { 
     updateList(); 
    } 

    @Override 
    protected Void doInBackground(Void... arg0) { 
     cloudFiles = getCloudContent(); 
     return null; 
    } 
} 

getCloudContent基本上是從教程retrieveAllFiles功能。

但是,我總是得到一些警告和錯誤,文件不會顯示。

01-09 19:39:31.347: W/dalvikvm(27926): VFY: unable to resolve static field 1488 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string; 
01-09 19:39:31.347: D/dalvikvm(27926): VFY: replacing opcode 0x60 at 0x0004 
01-09 19:39:31.446: W/GooglePlayServicesUtil(27926): Google Play services out of date. Requires 2012100 but found 1015 
01-09 19:39:31.446: E/GoogleAuthUtil(27926): GooglePlayServices not available due to error 2 
01-09 19:39:31.456: I/System.out(27926): An error occurred: com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException 

我使用Android SDK和最新的Google Play服務安裝Eclipse Juno的最新安裝。我使用仿真設備。 google-play-services.jar位於我的項目的參考庫中。 Google Drive api v2也包含在所描述的教程中。

任何幫助表示讚賞!

+0

此錯誤只與模擬器相關,在真正的Android設備上應用程序工作正常。然而,因爲我沒有永久訪問Android設備,我真的希望看到它在仿真器上運行。 –

+0

嘿保羅! 我在設備上遇到同樣的問題,但其中一項活動可以在Admob上正常運行,其他部隊關閉時會出現上述錯誤。 你能幫我嗎? –

回答

5

正如錯誤消息所示,仿真圖像上的Google Play服務版本不是最新的。嘗試檢查是否有可供您使用的較新的Android圖像。

否則,僅僅在物理設備而不是仿真器上運行應用程序會更容易。

+0

不,沒有,正如我所說我檢查了一切,我有最新版本。不幸的是,我現在沒有物理的Android設備,所以我必須堅持使用模擬器。 –

+0

我仔細檢查了,我有4版本,在安裝對話框,它說:歸檔描述 存檔任何操作系統 尺寸:3,6 MIB SHA1:bbb3d11225fcf60a0bae75afa2c4737010468bf6能否也許有人證實這一點SHA1和RESP。修訂? –

1

問題是您沒有Android設備上的Google Play服務。您可以將Google Play Service APK加載到模擬器上以解決問題。

或者你可以使用谷歌API類型的模擬器,但請注意,API 22我一直沒有爲我工作,但API 21工作巫婆是easyer然後找到正確的版本安裝播放服務apks。

有關APK的提示,您可能需要com.google.android.vending com.google.android.gsm和Google平臺類型的一點愛。

1

希望它可以幫助別人面臨的問題現在

此問題也來當你更新你的手機,並

  • 沒有登錄的谷歌帳戶,所以首先開打店,登錄你的帳戶。
  • 沒有更新谷歌瀏覽器。並打開谷歌瀏覽器並按照步驟
  • 如果可能的話重啓手機。

你準備好了。

相關問題