Google Play services resources were not found.
09-19 18:33:22.090: E/GooglePlayServicesUtil(1815): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
今天更新了sdk到 4.3後, 發生了以上問題.
導致map api key v2失效,地圖無法顯示.出現白畫面.
查了老半天,終於發現解決方法:
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
class="com.google.android.gms.maps.MapFragment" />
修正成:
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" class="com.google.android.gms.maps.SupportMapFragment" />
2. Remove this line from the manifest file:
Take a look at this blog post and make sure are doing everything correctly:
3. 確定api key正確, 使用 registering the API key using the API Console,因debug.keystore 與正式release key是不同的.
4.
5.於sdk manager中,重新安裝 google play service,(先移除在安裝. ),記得要進去sdk manager 的tool-option中先clear cache.
6.
今天更新了sdk到 4.3後, 發生了以上問題.
導致map api key v2失效,地圖無法顯示.出現白畫面.
查了老半天,終於發現解決方法:
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
class="com.google.android.gms.maps.MapFragment" />
修正成:
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" class="com.google.android.gms.maps.SupportMapFragment" />
2. Remove this line from the manifest file:
<uses-library android:name="com.google.android.maps" />
This is Google Maps API V1
permission and shouldn't be use in API V2
.Take a look at this blog post and make sure are doing everything correctly:
3. 確定api key正確, 使用 registering the API key using the API Console,因debug.keystore 與正式release key是不同的.
4.
確定相關權限有開:
<permission
android:name="com.mark.taipeimrt.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<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="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.xxx.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
5.於sdk manager中,重新安裝 google play service,(先移除在安裝. ),記得要進去sdk manager 的tool-option中先clear cache.
6.
刪除google-play-services_lib專案於eclipse(但不要選delete於硬碟中),重新再匯入一次
google-play-services_lib專案.並clean project.
7.於測試機中移除app ,不可只是re-install.
8.確定wifi 與gps開啟.
9.clean all project and run.
以上步驟後,我的app中的地圖就可顯示了.
後記: ps: 最後發現沒有wifi/3g 連線時,就會出現上列訊息.
所以第一次run時,沒網路連線,就會顯示白畫面,會讓開發者以為是google play service有問題,但其實是沒網路連線.只要第一次成功顯示地圖後,就會快取下來,下次就不會白畫面.
ps注意:android 4.4 sdk更新之後, google play service就有分新版跟舊版2.x兩種,
如要用新版就要用上述方式.
但不想改動code,就要import
google play service for 2.x版本.
感謝你的這篇網誌也幫助我解決遇到的問題 :)
回覆刪除