从一个活动开始活动到另一个活动时,我没有收到类def def错误。我正在使用android studio ide。它简单我不知道为什么它给我这个错误,因为它适用于另一个活动。我使用下面的代码..它很简单我不知道它突然给我没有类def发现错误。
Intent i = new Intent();
i.setClass(getApplicationContext(), Activity2.class);
startActivity(i);
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bhu.var" >
<application
android:name=".application.BHUApplication"
android:allowBackup="true"
android:icon="@drawable/appicon"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/BHUTheme"
android:largeHeap="true" >
<activity
android:name=".SplashScreen"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activity2"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
logcat的:
10-31 09:25:21.034 32645-32645/com.bhu.var E/dalvikvm﹕ Could not find class
'com.bhu.var.Activity2', referenced from method com.bhu.var.SplashScreen$1.handleMessage
10-31 09:25:24.260 32645-32645/com.bhu.var E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.bhu.var, PID: 32645
java.lang.NoClassDefFoundError: com.bhu.var.Activity2
at com.pepup.league.launcher.SplashScreen$1.handleMessage(SplashScreen.java:45)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)