HY!
我得到一个ClassNotFoundException,但不知道为什么。
代码:
startActivityForResult(new Intent(Main.this,MView.class),1);
package android.korn.geopictureview;
import com.google.android.maps.*;
public class MView extends MapActivity{
@Override
protected void onCreate(android.os.Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.mapview);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
清单:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".Main" android:theme="@android:style/Theme.NoTitleBar"
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=".MView"/>
</application>
<uses-permission android:name="android.permission.INTERNET" />
日志:
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): java.lang.NoClassDefFoundError: android.korn.geopictureview.MView
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.korn.geopictureview.Main.onActivityResult(Main.java:49)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.app.Activity.dispatchActivityResult(Activity.java:3828)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.app.ActivityThread.deliverResults(ActivityThread.java:3325)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3371)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.app.ActivityThread.access$2700(ActivityThread.java:119)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1893)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.os.Handler.dispatchMessage(Handler.java:99)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.os.Looper.loop(Looper.java:123)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at android.app.ActivityThread.main(ActivityThread.java:4363)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at java.lang.reflect.Method.invokeNative(Native Method)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at java.lang.reflect.Method.invoke(Method.java:521)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at dalvik.system.NativeStart.main(Native Method)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at dalvik.system.DexFile.defineClass(Native Method)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:209)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
05-28 16:00:28.183: ERROR/AndroidRuntime(1925): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
答案 0 :(得分:0)
当您对项目中的maps.jar有多个引用时,似乎会发生这种情况,请仔细检查它是否只添加并引用了一次。