Android NoClassDefFoundError映射视图活动
我已将mapview活动添加到应用程序中,尝试打开mapview活动会导致崩溃。我不熟悉这个问题,这里的其他线程倾向于引用libs,我似乎没有,或者类路径,这可能是问题所在,但我并不真正理解它 正如您所看到的,它非常简单,没有其他MyMapViewer类 mainfest添加此库 并添加权限Android NoClassDefFoundError映射视图活动,android,android-mapview,noclassdeffounderror,Android,Android Mapview,Noclassdeffounderror,我已将mapview活动添加到应用程序中,尝试打开mapview活动会导致崩溃。我不熟悉这个问题,这里的其他线程倾向于引用libs,我似乎没有,或者类路径,这可能是问题所在,但我并不真正理解它 正如您所看到的,它非常简单,没有其他MyMapViewer类 mainfest添加此库 并添加权限 <!--permissions --> <uses-permission android:name="android.permission.INTERNET"
<!--permissions -->
<uses-permission
android:name="android.permission.INTERNET">
</uses-permission>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION">
</uses-permission>
MyMapView你放了什么package
?您是否记得将此活动添加到清单中?MyMapView活动与其他活动位于同一个包中,只有一个包。是的,在舱单上。我也会在中编辑。请将代码发布到updatewatherview()
。您是否在WeekSevenTwoActivity
中意外导入了其他MyMapViewer
?(这可能会导致不同的异常…)嗯,它不会崩溃。非常感谢。MapView只是显示了网格,我制作的一个老应用现在也这样做了,这可能与谷歌改变api有关吗?
public class MyMapViewer extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {//class begins
super.onCreate(savedInstanceState);
setContentView(R.layout.my_mapview);//sets the layout to the xml
MapView mapView = (MapView) findViewById(R.id.mapview);//creates a new mapview initialisation
mapView.setBuiltInZoomControls(true);//adds the zoom function to the map
List<Overlay> mapOverlays = mapView.getOverlays();//the mapOverlay listobject is initialised to teh mapView
Drawable drawable = this.getResources().getDrawable(R.drawable.station_icon);//points to marker icon
MyItemizedOverlay itemizedoverlay = new MyItemizedOverlay(drawable, this);//instantiates Itemizer
GeoPoint point = new GeoPoint((int)(54.684624 * 1e6),
(int)(-5.880218 * 1e6));//converts double cords to microdegrees for Geopoint
OverlayItem overlayitem = new OverlayItem(point, "Jordanstown", "Shore Road, Newtownabbey, Belfast, Antrim BT370QB ");
GeoPoint point1 = new GeoPoint((int)(54.66370520273512 * 1e6),
(int)(-5.930986404418945 * 1e6));//converts double cords to microdegrees for Geopoint
OverlayItem overlayitem2 = new OverlayItem(point1, "Valley JuiJitsu Club", "Valley Park Newtownabbey BT36 6");
GeoPoint point2 = new GeoPoint((int)(54.644600844283104 * 1e6),
(int)(-5.666391849517822 * 1e6));//converts double cords to microdegrees for Geopoint
OverlayItem overlayitem3 = new OverlayItem(point2, "Peninsula Martial Arts", "3 Balloo Link, Bangor, Down BT19 7HJ");
itemizedoverlay.addOverlay(overlayitem); //calls teh addOverlay method
mapOverlays.add(itemizedoverlay);//adds above to the itemizedoverlay
}//end of class
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}//a necessary generated method
}
<?xml version="1.0" encoding="utf-8"?> <manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.b00517566.weekST"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="9" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".WeekSevenTwoActivity"
android:label="@string/app_name" >
</activity>
<activity android:name="splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="MyMapViewer"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
</application>
</manifest>
private void updateWeatherView() {
startActivity(new Intent(this, MyMapViewer.class));
}//end of method
<!--permissions -->
<uses-permission
android:name="android.permission.INTERNET">
</uses-permission>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION">
</uses-permission>