我是新來的Android編程和在Eclipse.I一個項目嘗試的第一個tutorial'HelloWorld」,並得到了這個錯誤:Android的「找不到類」錯誤
Could not find class 'com.esri.android.map.MapView', referenced from method com.esri.arcgis.android.samples.helloworld.HelloWorldActivity.onCreate
- 是否有是一個名爲MapView
的佈局?如果是這樣,我沒有在我的項目。你能告訴我怎樣才能把它帶入項目?
我也有項目中的所有源文件夾。即使是mapview,也不知道它爲什麼會顯示這種錯誤。我需要這個項目的幫助,我需要在幾天內完成它,但由於這個錯誤我卡住了,無法繼續。我在我的所有項目中都面臨同樣的問題,儘管我嘗試的每個項目都是ArcGIS提供的示例。
下面是代碼:
package com.esri.arcgis.android.samples.helloworld;
import android.app.Activity;
import android.os.Bundle;
import com.esri.android.map.MapView;
import com.esri.android.map.ags.ArcGISTiledMapServiceLayer;
public class HelloWorldActivity extends Activity {
MapView map = null;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Retrieve the map and initial extent from XML layout
map = (MapView)findViewById(R.id.map);
// Add dynamic layer to MapView
map.addLayer(new ArcGISTiledMapServiceLayer("" +
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
}
protected void onPause() {
super.onPause();
map.pause();
}
protected void onResume() {
super.onResume();
map.unpause();
}
}
'com.esri.arcgis.android.samples.helloworld'你的包名? – 2012-04-27 20:10:51
是的,這是包名 – Aisha 2012-04-27 20:18:31