2010-10-19 124 views
0

我的地圖活動在啓動時崩潰。我已經包含了所有的權限,並且在一個新的獨立的地圖項目上進行了測試,它與底層代碼很好地協作。地圖活動在調用時崩潰!

相反,當我在應用程序中合併相同的代碼時,只要調用此活動就會崩潰。我的一個項目提交明天早上有,所以請儘快回覆

我的地圖活動如下

  package com.healthcare.iFind; 

      import com.google.android.maps.MapActivity; 
      import com.google.android.maps.MapView; 
      import com.google.android.maps.MapView.LayoutParams; 

      import android.os.Bundle; 
      import android.view.View; 
      import android.widget.LinearLayout; 

      public class MapsActivity extends MapActivity 
      { 
      MapView mapView; 

      /** Called when the activity is first created. */ 
      @Override 
      public void onCreate(Bundle savedInstanceState) 
      { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.maps); 


      mapView = (MapView) findViewById(R.id.mapView); 
      LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom); 
      View zoomView = mapView.getZoomControls(); 

      zoomLayout.addView(zoomView, 
      new LinearLayout.LayoutParams(
      LayoutParams.WRAP_CONTENT, 
      LayoutParams.WRAP_CONTENT)); 
      mapView.displayZoomControls(true); 

      } 

      @Override 
      protected boolean isRouteDisplayed() { 
      // TODO Auto-generated method stub 
      return false; 
      } 
      } 

我的AndroidManifest.xml文件:

  <?xml version="1.0" encoding="utf-8"?> 
      <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
      package="com.healthcare.iFind" 
      android:versionCode="1" 
      android:versionName="1.0.0"> 
      <application android:icon="@drawable/icon" android:label="@string/app_name"> 
      <uses-library android:name="com.google.android.maps" /> 
      <activity android:name=".HomeScreen" 
      android:label="@string/app_name"> 
      <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
      </activity> 
      <activity android:name="MessageList"></activity> 
      <activity android:name="RateDoctor"></activity> 
      <activity android:name="RateQuiz"></activity> 
      <activity android:name="DetailedDoctor"></activity> 
      <activity android:name="DoctorProfile"></activity> 
      <activity android:name=".MapsActivity"/> 
      </application> 

我maplayout.xml文件。

  </manifest> 

      <?xml version="1.0" encoding="utf-8"?> 
      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 

      <com.google.android.maps.MapView 
      android:id="@+id/mapView" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:enabled="true" 
      android:clickable="true" 
      android:apiKey="mykey" 
      /> 
      <LinearLayout android:id="@+id/zoom" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_centerHorizontal="true" 
      /> 

      </RelativeLayout> 
+1

請不要說你的問題很緊急;它不會加速事情。如何提出問題智能方法 - http://www.catb.org/esr/faqs/smart-questions.html#urgent - 建議閱讀任何人在這些社區網站上尋求幫助。 – junkdog 2010-10-19 06:58:50

+3

這就是說,你的logcat說什麼?它應該說錯誤發生在哪裏 - 如果您使用的是Eclipse,請轉到DDMS視角。 – junkdog 2010-10-19 07:01:35

+0

它說,無法解析超級類的Lcom/healthcare/iFind/MapsActivity;它基本上顯示了一個NoClassDefFoundError。但是我包含了Google API + Android 2.2包,並且在我的Eclipse代碼中也沒有出現錯誤。我能做什麼錯了?對於這種緊急情況,我很抱歉,我一直在研究這個問題,而且我沒有讓我的應用看起來很笨,我不會再這樣做。 – standroid 2010-10-19 13:23:28

回答

0

alt text

旁邊的紅線,沒有您的工作空間像她那樣。只是爲了確保你正在編譯API而不是常規的2.2包。

此代碼在我的模擬器上運行得很好。 (2.2使用谷歌API)

以防萬一,變化:

<activity android:name=".MapsActivity"/> 

<activity android:name=".MapsActivity"/></activity> 

它不應該做多大的性差異,但只是爲了讓您清單的一致性。

+0

我擁有與您所說的一切完全一樣的東西,看起來像我的模擬器出了問題。但不是這個錯誤支持怪異?:Lcom/healthcare/iFind/MapsActivity – standroid 2010-10-19 16:15:31

+0

從logcat發佈更多信息,它不會至少給出一個崩潰的行。將整個logCat錯誤複製到原始問題中。 您可以嘗試刪除該AVD並創建一個新的AVD。 – blindstuff 2010-10-19 16:18:41

+0

我創建了一個新的AVD,但問題仍然存在。這是Logcat中的錯誤:http://fpaste.org/B3fX/ – standroid 2010-10-19 17:33:20