无法在模拟器

时间:2015-08-22 10:09:34

标签: android eclipse

我正在使用Eclipse进行Android原生开发。对于小样本模拟器正在工作,但当我导入Project并使其运行时,我点击了应用程序图标。

它显示警告The application Customer Assist(Process com.blo.customer_Assist) has stopped unexpectedly. Please try again.

我用Google搜索但未找到解决方案

logcat的

08-23 13:51:14.571: I/dalvikvm(309): Could not find method com.blo.Customer_Assist.activities.RescueActivity.getActionBar, referenced from method com.blo.Customer_Assist.activities.RescueActivity.onCreate
08-23 13:51:14.571: W/dalvikvm(309): VFY: unable to resolve virtual method 5941: Lcom/blo/Customer_Assist/activities/RescueActivity;.getActionBar ()Landroid/app/ActionBar;
08-23 13:51:14.571: D/dalvikvm(309): VFY: replacing opcode 0x6e at 0x0006
08-23 13:51:14.571: D/dalvikvm(309): VFY: dead code 0x0009-0077 in Lcom/blo/Customer_Assist/activities/RescueActivity;.onCreate (Landroid/os/Bundle;)V
08-23 13:51:14.581: I/dalvikvm(309): Could not find method android.content.SharedPreferences.getStringSet, referenced from method com.blo.Customer_Assist.activities.BaseActivity.getPreferenceValue
08-23 13:51:14.581: W/dalvikvm(309): VFY: unable to resolve interface method 325: Landroid/content/SharedPreferences;.getStringSet (Ljava/lang/String;Ljava/util/Set;)Ljava/util/Set;
08-23 13:51:14.581: D/dalvikvm(309): VFY: replacing opcode 0x72 at 0x0011
08-23 13:51:14.591: D/dalvikvm(309): VFY: dead code 0x0014-0014 in Lcom/blo/Customer_Assist/activities/BaseActivity;.getPreferenceValue (Ljava/lang/String;)Ljava/lang/Object;
08-23 13:51:14.601: I/dalvikvm(309): Could not find method android.content.SharedPreferences$Editor.putStringSet, referenced from method com.blo.Customer_Assist.activities.BaseActivity.setPreferenceValue
08-23 13:51:14.601: W/dalvikvm(309): VFY: unable to resolve interface method 316: Landroid/content/SharedPreferences$Editor;.putStringSet (Ljava/lang/String;Ljava/util/Set;)Landroid/content/SharedPreferences$Editor;
08-23 13:51:14.611: D/dalvikvm(309): VFY: replacing opcode 0x72 at 0x0012
08-23 13:51:14.611: I/dalvikvm(309): Could not find method android.content.SharedPreferences$Editor.apply, referenced from method com.blo.Customer_Assist.activities.BaseActivity.setPreferenceValue
08-23 13:51:14.611: W/dalvikvm(309): VFY: unable to resolve interface method 309: Landroid/content/SharedPreferences$Editor;.apply ()V
08-23 13:51:14.621: D/dalvikvm(309): VFY: replacing opcode 0x72 at 0x0018
08-23 13:51:14.621: D/dalvikvm(309): VFY: dead code 0x001b-001b in Lcom/blo/Customer_Assist/activities/BaseActivity;.setPreferenceValue (Ljava/lang/String;Ljava/lang/Object;)V
08-23 13:51:14.660: E/ResourceType(309): Style contains key with bad entry: 0x010102ce
08-23 13:51:14.671: D/AndroidRuntime(309): Shutting down VM
08-23 13:51:14.671: W/dalvikvm(309): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-23 13:51:14.691: E/AndroidRuntime(309): FATAL EXCEPTION: main
08-23 13:51:14.691: E/AndroidRuntime(309): java.lang.NoSuchMethodError: com.blo.Customer_Assist.activities.RescueActivity.getActionBar
08-23 13:51:14.691: E/AndroidRuntime(309):  at com.blo.Customer_Assist.activities.RescueActivity.onCreate(RescueActivity.java:449)
08-23 13:51:14.691: E/AndroidRuntime(309):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-23 13:51:14.691: E/AndroidRuntime(309):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-23 13:51:14.691: E/AndroidRuntime(309):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-23 13:51:14.691: E/AndroidRuntime(309):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-23 13:51:14.691: E/AndroidRuntime(309):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-23 13:51:14.691: E/AndroidRuntime(309):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 13:51:14.691: E/AndroidRuntime(309):  at android.os.Looper.loop(Looper.java:123)
08-23 13:51:14.691: E/AndroidRuntime(309):  at android.app.ActivityThread.main(ActivityThread.java:4627)
08-23 13:51:14.691: E/AndroidRuntime(309):  at java.lang.reflect.Method.invokeNative(Native Method)
08-23 13:51:14.691: E/AndroidRuntime(309):  at java.lang.reflect.Method.invoke(Method.java:521)
08-23 13:51:14.691: E/AndroidRuntime(309):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-23 13:51:14.691: E/AndroidRuntime(309):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-23 13:51:14.691: E/AndroidRuntime(309):  at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

您的LogCat中已有指示

Could not find method     com.blo.Customer_Assist.activities.RescueActivity.getActionBar, referenced from      method com.blo.Customer_Assist.activities.RescueActivity.onCreate

模拟器会破坏您的应用,因此您无法启动它。 它无法在上述getActionBar()类中找到Activity方法。虽然听起来很奇怪,因为Android中的所有活动都有这种方法。你确定你已经扩展了Activity类并在那之后使用了括号吗?你也可以发布代码,以便我确认吗?

PS:还要提一下您在模拟器中尝试使用哪个版本的Android操作系统以及最低和目标API级别是什么?

<强>更新
ActionBars在HoneyComb(API级别11)中实现。因此,要么将minSdkVersion更改为11,要么使用支持库来获取功能并使用getSupportActionBar()代替。更多细节在这里 - ActionBar