2011-04-29 71 views
2

Eclipse沒有指出我的代碼中有任何錯誤。當我嘗試運行模擬器時出現異常。這是我所有的代碼。Android InstallException:EOF Google MapsView「Hello Maps」

HelloGoogleMaps.java

package com.example.hellogooglemaps; 

import android.app.Activity; 
import android.os.Bundle; 
import com.google.android.maps.*; 
import android.widget.LinearLayout; 
import android.widget.ZoomControls; 


public class HelloGoogleMaps extends MapActivity 
{ 
    LinearLayout linearLayout; 
    MapView mapView; 
    ZoomControls mZoom; 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.main); 
    } 


    @Override 
    protected boolean isRouteDisplayed() { 
      return false; 
    } 



} 

main.xml中的文件:

<?xml version="1.0" encoding="utf-8"?> 
<com.google.android.maps.MapView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/mapview" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:clickable="true" 
android:apiKey="my_api_key" //I have this in my program. Just not putting it in post. 

/>

HelloGoogleMaps艙單

<?xml version="1.0" encoding="utf-8"?> 

<application android:icon="@drawable/icon" android:label="@string/app_name"> 
<uses-library android:name="com.google.android.maps" /> 
    <activity android:name=".HelloGoogleMaps" 
       android:label="@string/app_name" 
       android:theme="@android:style/Theme.NoTitleBar"> 

     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

</application> 

編輯調試顯示以下內容:

ERROR: the user data image is used by another emulator. aborting 

EDIT 2控制檯也給出了這樣的警告:

Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz. 

編輯3它現在安裝,但應用程序意外退出模擬器。

回答

1

關閉所有模擬器。重新啓動Eclipse。刷新您的項目。右鍵單擊您的項目,將鼠標懸停在Android工具上並選擇修復項目屬性。查找未創建的空白XML文件,如果存在,請將其刪除。

這些事情之一應該工作。

+0

沒有工作。我沒有在eclipse左邊的目錄中看到一個空白的XML文件。 「無法在設備'emulator-5556上安裝HelloGoogleMaps.apk!(null)」 – STANGMMX 2011-04-29 22:21:40

+0

此空白XML文件在哪裏?也許我在看錯地方。 – STANGMMX 2011-04-29 22:42:20

+0

另外,我正在運行Mac OSX。不知道這是否會有所作爲。 – STANGMMX 2011-04-29 22:42:36

1

做一步一步:

  • 重新啓動PC,以確保沒有模擬器進程在後臺運行
  • 啓動Eclipse(所有可用)
  • 開始
  • 清潔項目的項目

如果這不能解決它,請從模擬器中刪除應用程序,並嘗試再次啓動它。

如果這樣不能解決它,你應該嘗試刪除AVD並創建一個新的...

+0

將API降至10以及AVD,並安裝。但隨後應用程序意外退出。 「GoogleMapsView(進程com.example.googlemapsview)意外停止,請重試。」 – STANGMMX 2011-04-30 00:56:07