跳转到下一个活动时出错

时间:2011-04-30 05:47:00

标签: android

Friends.java
Intent intent = new Intent(Friends.this,MyMapActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent,0);

的AndroidManifest.xml

<activity android:name=".MyMapActivity"
android:label="@string/app_name"
android:theme="@androidtyle/Theme.NoTitleBar">
</activity>

ERROR:

04-30 11:38:53.165: ERROR/AndroidRuntime(822): FATAL EXCEPTION: main
04-30 11:38:53.165: ERROR/AndroidRuntime(822): java.lang.NoClassDefFoundError: com.bestdambikers.MyMapActivity
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at com.bestdambikers.Friends$5.onClick(Friends.java:793)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at android.view.View.performClick(View.java:2485)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at android.view.View$PerformClick.run(View.java:9080)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at android.os.Handler.handleCallback(Handler.java:587)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at android.os.Handler.dispatchMessage(Handler.java:92)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at android.os.Looper.loop(Looper.java:123)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at android.app.ActivityThread.main(ActivityThread.java:3647)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at java.lang.reflect.Method.invokeNative(Native Method)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at java.lang.reflect.Method.invoke(Method.java:507)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at dalvik.system.NativeStart.main(Native Method)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at dalvik.system.DexFile.defineClass(Native Method)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:200)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-30 11:38:53.165: ERROR/AndroidRuntime(822): ... 12 more

我不知道为什么我会收到此错误。我也试过startActivity(new Intent(Friend.this,MyMapActivity.class)); 即使我犯了这个错误。

我也在Manifest文件中声明了这个类。

3 个答案:

答案 0 :(得分:2)

在Manifest中你有MyMapctivity,在代码MYMapActivity中......字符“y”和“Y”不同...... =)

  

意图意图=新   意图(Friends.this,MyMapActivity.class);

  

活性   机器人:名称= “MYMapActivity”

类的名称不同......到处更改为MyMapActivity ....

答案 1 :(得分:0)

在清单中添加您的活动..

<activity android:name="MapActivity" ></activity>

答案 2 :(得分:0)

清理项目,然后重新编译它。