2011-03-08 139 views
0

我正在嘗試製作Android地圖應用程序。由於我對這一切都很陌生,因此我正在擺弄基礎知識,所以我決定創建一個地圖,顯示一個按鈕和數字時鐘。MapView應用程序崩潰

當我運行該項目時,模擬器加載,但是當它試圖加載它強制關閉的應用程序。

main.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <DigitalClock android:text="@+id/DigitalClock01" 
     android:id="@+id/DigitalClock01" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"></DigitalClock> 
    <Button android:text="@+id/Button01" 
     android:layout_width="wrap_content" 
     android:id="@+id/Button01" 
     android:layout_height="wrap_content"></Button> 
    <com.google.android.maps.MapView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:apiKey="xyz_my_key" /> 
</LinearLayout> 

在我的表現我已經添加了uses-library定義

<uses-library android:name="com.google.android.maps"/> 

,我也加入了互聯網的使用許可

<uses-permission android:name="android.permission.INTERNET"></uses-permission> 

爲什麼崩潰?

從錯誤日誌中最後一個條目:在運行時

沒有命令的輸出:「我 開始-n com.example.android.google.apis/com.example.android.google.apis.com .example.android.apis.MapsDemo -a android.intent.action.MAIN -c上 設備模擬器-5554 android.intent.category.LAUNCHER」

+0

你使用MapActivity? – 2011-03-08 20:37:29

+0

對不起聲音啞巴,但我將如何檢查? – 2011-03-08 20:39:18

+1

發佈錯誤日誌中的最後一條消息,否則我們將無法找到問題的原因,這可能幾乎是任何事情。 – slhck 2011-03-08 20:41:19

回答

0

我沒有安裝工程正常。我已經回去重新開始複製​​和粘貼的來源和嘿presto它的作品

+0

你做錯了什麼? – tgoossens 2012-08-07 12:02:08

+0

沒有設置谷歌API – 2012-09-06 09:55:37