我有一个Android应用程序,它使用外部库(appcompat-v7)作为操作栏。我的应用程序从注册活动开始,然后登录活动,并在成功登录后启动仪表板活动,其中包含带有选项卡和滑动的操作栏。注册活动和登录活动工作正常,但当我点击登录按钮应用程序崩溃与标题中提到的错误。我已将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
这是Manifest
<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();
Log Cat
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
答案 0 :(得分:0)
检查Order and Export
Java Build Path
标签中的库
答案 1 :(得分:0)
Manifest中类名前面的前缀点。如果此类在特定包中,请在清单中提及。
<activity android:name=".DashBoard"></activity>
请检查这是否是问题。
答案 2 :(得分:0)
尝试在运行前删除bin文件夹。我遇到了这个问题并删除了保存箱文件夹