Hy!
I get a ClassNotFoundException but don't know why.
Code:
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;
}
}
Manifest:
<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" />
Log:
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)
This seems to happen when you have more then one reference to the maps.jar in your project, double check that it is added and referenced only once.
精彩评论