[問題] google地圖無法在模擬器上顯示
最近因為要用到google地圖,所以用debug keystore產生一組sha1到網路申請api key
我先開啟service中的google maps android api v2和google maps api v2後
然後在androidmanifest中寫入
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
以及
<uses-library android:name="com.google.android.maps"/>
接著在layout部分我寫了
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey="(我的api key)" />
</LinearLayout>
最後就是在main中把繼承自activity改成繼承自MapActivity然後實作
isRouteDisplayed這個方法(不過實際上我只是把它放進來沒更改它)
但是在run的時候locat給我的訊息是"couldn't get connection factory client
而且在layout部分則出現
”Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout,
or fix the theme style references
Failed to find style 'mapViewStyle' in current theme“這樣的訊息
結果就是在模擬器中只跑出灰色格子,地圖沒辦法顯示出來。因為用了一整天
上網找的答案都沒辦法解決所以想問一下板上有人也有遇到這樣問題過嗎?
還是我有少漏掉什麼部分沒做的呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.168.217.208
→
04/14 17:39, , 1F
04/14 17:39, 1F
→
04/14 18:57, , 2F
04/14 18:57, 2F
→
04/14 19:53, , 3F
04/14 19:53, 3F
→
04/14 19:54, , 4F
04/14 19:54, 4F
→
04/14 19:55, , 5F
04/14 19:55, 5F
→
04/14 19:55, , 6F
04/14 19:55, 6F
→
04/14 19:57, , 7F
04/14 19:57, 7F
→
04/14 22:11, , 8F
04/14 22:11, 8F
→
04/14 22:54, , 9F
04/14 22:54, 9F
剛剛逛google時候看到這一篇http://ppt.cc/A7aL
他的方法跟我設定的不太一樣
不曉得有沒有人試過可以分享一下有沒有成功
※ 編輯: fortooth 來自: 118.168.217.208 (04/15 01:35)
→
04/15 07:42, , 10F
04/15 07:42, 10F
→
04/15 09:05, , 11F
04/15 09:05, 11F
→
04/15 09:09, , 12F
04/15 09:09, 12F
→
04/15 09:09, , 13F
04/15 09:09, 13F
→
04/15 09:10, , 14F
04/15 09:10, 14F
→
04/15 14:16, , 15F
04/15 14:16, 15F
推
04/16 12:12, , 16F
04/16 12:12, 16F
→
04/16 15:58, , 17F
04/16 15:58, 17F
→
04/16 15:59, , 18F
04/16 15:59, 18F
→
04/16 15:59, , 19F
04/16 15:59, 19F
推
04/18 00:41, , 20F
04/18 00:41, 20F
→
04/21 17:22, , 21F
04/21 17:22, 21F
→
04/21 17:23, , 22F
04/21 17:23, 22F