根據Google Play服務的不同,推薦的做法是保持Android應用的最大後向兼容性?最大限度地提高Google Play服務的向後兼容性
使用過Android Studio開發人員實現文檔表明對編譯V5 + compile 'com.google.android.gms:play-services:5.+'
與我使用似乎最終使用的版本5208000.可用下載在這一點,我得到的錯誤和警告,同時測試應用程序返回:
W/GooglePlayServicesUtil Google Play services out of date. Requires 5208000 but found 5089036
E/GooglePlayServicesUtil GooglePlayServices not available due to error 2
但是,我對Google Play服務的依賴Admob似乎正常工作。如果您按照Google的建議致電isGooglePlayServicesAvailable()
和GooglePlayServicesUtil.getErrorDialog()
,系統會通知用戶應用程序需要升級才能運行併發送到沒有可用更新的商店。
在其他地方維護向後兼容性意味着編譯支持您需要的功能的最早的API版本。所以,我想與V4 compile 'com.google.android.gms:play-services:4.+'
產生的另錯誤:
E/GooglePlayServicesUtil﹕ The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
搜索周圍的結果表明是虛假報告,可以忽略不計。
如果我針對更新的API版本進行編譯,並且它不存在於設備上,那麼情況會起作用嗎?或者我必須哄用戶升級?針對較舊的API版本進行編譯並假定事情與設備上運行的較新版本正確向後兼容是否更好?
感謝您的評論,他們重申我的理解。令人困惑的部分是Google文檔爲什麼建議做一些不是最佳實踐的事情,而且實際上存在問題。 – ertyu 2014-09-12 18:37:14