0

我有一个使用外部库(appcompat-v7)作为操作栏的 android 应用程序。我的应用程序从注册活动开始,然后是登录活动,并在成功登录后启动仪表板活动,该活动具有带有选项卡和滑动的操作栏。注册活动和登录活动工作正常,但是当我单击登录按钮时,应用程序崩溃并出现标题中提到的错误。我已将 appcompat 库添加到我的工作空间,也添加到了我的项目中。我在 SO 检查了许多解决方案,但没有一个对我有用。这是我已经完成的步骤。

Added appcompat to workspace as library project as mention on developer.android page. 
Added jar files of appcompat to build path of appcompat unchecked android dependencies.
Added appcompat library project to my project (say Project X)
Checked all library of project X, fix project properties, clean and rebuild.  
Moved android private libraries to top on order and Export tab.
added appcompatv7 to projects tab on Java build path.
Still no luck :(
My order and export tab looks like this from top to bottom
1-Android Private libraries 
2-Ksoap2-android-assembly-2.4-jar-with-dependencies.jar (Jar file is located in D:\jarfiles)
3-android Dependencies 
4-/gen
5-/src
6-Android 4.4.2 

这是清单

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/CustomActionBarTheme" >
        <activity
            android:name="com.example.appname.registration.Register" (only com.example.appname is replaced with original name of application when posted on SO)
            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=".registration.SignIn"></activity>
        <activity android:name="DashBoard"></activity>
    </application>

这是登录 OnClick 事件

Intent dashboardintent = new Intent(getApplicationContext(), DashBoard.class);
startActivity(dashboardintent);
finish();

在此处输入图像描述 在此处输入图像描述

原木猫

01-28 14:09:14.942: E/AndroidRuntime(658): FATAL EXCEPTION: main
01-28 14:09:14.942: E/AndroidRuntime(658): java.lang.NoClassDefFoundError: com.example.appname.DashBoard
01-28 14:09:14.942: E/AndroidRuntime(658):  at com.example.appname.registration.SignIn$1.onClick(SignIn.java:59)
01-28 14:09:14.942: E/AndroidRuntime(658):  at android.view.View.performClick(View.java:2485)
01-28 14:09:14.942: E/AndroidRuntime(658):  at android.view.View$PerformClick.run(View.java:9080)
01-28 14:09:14.942: E/AndroidRuntime(658):  at android.os.Handler.handleCallback(Handler.java:587)
01-28 14:09:14.942: E/AndroidRuntime(658):  at android.os.Handler.dispatchMessage(Handler.java:92)
01-28 14:09:14.942: E/AndroidRuntime(658):  at android.os.Looper.loop(Looper.java:123)
01-28 14:09:14.942: E/AndroidRuntime(658):  at android.app.ActivityThread.main(ActivityThread.java:3683)
01-28 14:09:14.942: E/AndroidRuntime(658):  at java.lang.reflect.Method.invokeNative(Native Method)
01-28 14:09:14.942: E/AndroidRuntime(658):  at java.lang.reflect.Method.invoke(Method.java:507)
01-28 14:09:14.942: E/AndroidRuntime(658):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-28 14:09:14.942: E/AndroidRuntime(658):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-28 14:09:14.942: E/AndroidRuntime(658):  at dalvik.system.NativeStart.main(Native Method)
01-28 14:09:16.602: I/Process(658): Sending signal. PID: 658 SIG: 9
4

3 回答 3

0

尝试在运行前删除 bin 文件夹。我遇到了这个问题并删除了 bin 文件夹保存了我

于 2014-05-14T12:41:09.520 回答
0

Manifest 中类名前面的前缀点。如果此类在特定包中,则在清单中提及。

<activity android:name=".DashBoard"></activity>

请检查这是否是问题所在。

于 2014-01-28T09:23:31.450 回答
0

在此处输入图像描述检查Order and Export下选项卡中的库Java Build Path

于 2014-01-28T07:55:49.537 回答