2012-01-21 43 views
0

上MainActivity.java我已經錯誤,NoClassDefFound

 host.addTab(host.newTabSpec("Map") 
      .setIndicator("Map",  getResources().getDrawable(R.drawable.icon_user)) 
      .setContent(new Intent(this, Map.class))); 

在Map.Java

public class Map extends MapActivity { 

MapView mapView; 

SharedPreferences prefs; 

    SharedPreferences.Editor prefEditor; 

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.map); 

    MapView mapView = (MapView) findViewById(R.id.myMapView1); 
    } 

在我Android.XML我已經包括

<activity android:name=".Map" 
       android:label="@string/app_name"> 
    </activity> 

錯誤行是MainActivity.java的Map.java類的host.addTab。它說NodefClassFound。它甚至意味着什麼?我已經在所有必需的領域中進行了定義。沒有語法錯誤,但運行時錯誤。

回答

1

您可能發佈了此錯誤的堆棧跟蹤。 我的猜測:嘗試將這些兩行添加到您的清單(如果他們現在還沒有):

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

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

第一個必須是應用程序標籤內。

+0

你是對的,順序是重要的,我把應用標籤之外的使用庫。謝謝 –

相關問題