The Google Play services resources were not found error.

今天遇到了The Google Play services resources were not found.
但專案裡面都有include... 搞不懂..
java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the element:    
solution:
If you receive this message you have a problem with the Google Services jar imported in project.
a) Cleaning and rebuilding might not help. If on Properties(click right-Properties-Android Dependencies list) the google services jar does not show, then the error is justified.

b) To fix this, Import-From existing sources-go to  source of SDK, C:\adt-bundle\sdk\extras\google\google_play_services_froyo\libproject\google-play-services_lib\libs and the in your project Add this jar to your path. Clean and rebuild, refresh and it should work.


 故注意import library時:

  C:\android-sdk\extras\google\play_service目錄\libproject\google-play-services_lib\libs

google_play_services_froyo : 給舊版使用的 (要選擇這個)
google_play_services:新版



只要選錯就會發生上述錯誤,目前還不清楚新api如何使用.
故還是選擇 google_play_services_froyo

 另注意:
order and export 中google-play-services.jar 要打勾,否則會出現此error:
java.lang.NoClassDefFoundError: com.google.android.gms.common.GooglePlayServicesUtil


ps:  另外還有一種可能是~~~Logcat若顯示:

java.lang.SecurityException: Neither user 10248 nor current process has android.permission.WAKE_LOCK.
要在androidManifest.xml加入此權限...
讓app配合java code有權限可讓螢幕保持喚醒.
但會導致手機耗電量大增...


java code方面 ,一般要使app運行過程中,螢幕保持常亮,使用的 api method中
透過 SCREEN_BRIGHT_WAKE_LOCK屬性就可:
>>CPU:ON
>>屏幕背光:ON
>>鍵盤燈:OFF

更詳細可參考
http://blog.csdn.net/z1074971432/article/details/6724694

因為cpu 會一直on,故會導致手機待機時間大幅縮短,故要提醒使用者,並且app設計師必須要在離開app時,設法release resource,當user已經離開app後,不可一直在背景執行.

 

留言

這個網誌中的熱門文章

最爛的銀行服務-玉山銀行

Mark App Design Apps - Terms and Privacy Policy (服務條款,隱私權政策)

SMR疊瓦式hdd致命缺陷被解決????!!!

ios app 上架時app icon要注意事項

更改google drive預設存放目錄位置Change Google Drive Default Folder Location in Windows

舊有app在Android 12 閃退問題& app Splash screens

google play 正式發布前測試報告...非常好用.

app bundle and bundletool. 關於aab安裝問題

關於google play console app應用程式簽署

Google Play badge徽章產生器