-1

I am using Eclipse for Android native development. For small Samples emulator is working, but when I imported Project and made to run, when I clicked on app icon.

It shows alert The application Customer Assist(Process com.blo.customer_Assist) has stopped unexpectedly. Please try again.

I googled it but didn't find solution

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)
allDroid
  • 395
  • 1
  • 7
  • 21
  • 1
    Post your full LogCat – Phantômaxx Aug 22 '15 at 10:15
  • @Frank N. Stein Please check logCat – allDroid Aug 22 '15 at 10:51
  • are you running app on device lower than api 11 i.e on android version gingerbread – Shadow Droid Aug 22 '15 at 11:01
  • 1
    If yes then inside onCreate of Activity instead of getActionBar use getSupportActionBar and import support library v7 or follow as described in http://android-developers.blogspot.co.il/2013/08/actionbarcompat-and-io-2013-app-source.html – Shadow Droid Aug 22 '15 at 11:04
  • @Shadow Droid android:minSdkVersion="8"targetSdkVersion="19" – allDroid Aug 22 '15 at 11:11
  • @berry that is what you have mention in manifest file...but I was asking version of device/emulator on which you are testing/running the app – Shadow Droid Aug 22 '15 at 11:13
  • @Shadow Droid its Android 2.3.3 and API level 10 – allDroid Aug 22 '15 at 11:40
  • that is why you are getting error....so solution is use getSupportActionBar method as mention in previous comments – Shadow Droid Aug 22 '15 at 11:46
  • @berry **False**. You said: `android:minSdkVersion="8"targetSdkVersion="19"`, therefore your minimum is Android **2.2** (Froyo), API Level **8**, and you are compiling with KitKat (API Level **19**) – Phantômaxx Aug 22 '15 at 11:53
  • 1
    @FrankN.Stein bcoz of that he was getting runtime error and not compile time error.... – Shadow Droid Aug 22 '15 at 11:58
  • @FrankN.Stein i created emulator of Android 4.4.2,platform 4.4.2 ,API level 19,CPU/ABI -ARM(armeabi-v7a).but i get alert Unfortunately Customer_Assist has stopped. – allDroid Aug 22 '15 at 17:32
  • This is **higher** (**19**) than the **minimum** required API Level (**8**). I said `lower or equal`. – Phantômaxx Aug 22 '15 at 20:02
  • @Frank N. Stein as guided i changed emulator that have Android 2.2,API level 8 but its give same alert of it cant open App. i have updated logcat please check – allDroid Aug 23 '15 at 11:27
  • Add the `support library`. Then change `getActionBar()` to `getSupportActionBar()`, as suggested by @noob – Phantômaxx Aug 23 '15 at 12:22
  • @Frank N. Stein i have added support libraries like android-suport-v7-appcompat.jar and android-support-v4.jar and when changed getactionbar to getsupportactionbar() it shows error saying change to getactionbar().pleaase check i have added image of files in folder. – allDroid Aug 23 '15 at 15:43

1 Answers1

0

There's an indication in your LogCat already

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

The emulator is crashing your app and thus you can't see it getting launched. It couldn't find the getActionBar() method in the mentioned Activity class. Although it does sound strange, since all Activities in Android have this method. Are you sure you have extended an Activity class and used parenthesis after that? Can you post the code also, so that I can confirm?

PS: Also mention which version of Android OS are you trying in the emulator and what's the Minimum and Target API level?

Update:
ActionBars were implemented in HoneyComb (API level 11). So either change the minSdkVersion to 11 or use a support library to get the functionality and use getSupportActionBar() instead. More details are here - ActionBar

noob
  • 17,131
  • 18
  • 103
  • 168
  • its Android 2.3.3 and API level 10.In Activity Class it has getactionBar() – allDroid Aug 22 '15 at 11:41
  • @berry **False**. You said: `android:minSdkVersion="8"targetSdkVersion="19"`, therefore your minimum is Android **2.2** (Froyo), API Level **8**, and you are compiling with KitKat (API Level **19**) – Phantômaxx Aug 22 '15 at 11:51
  • @Frank N. Stein should i change API level to 8 in run configration or what should i do to make emulator work.please help i dont know much about this. – allDroid Aug 22 '15 at 11:58
  • 1
    @berry You need to change it in the build.gradle file in the app folder. Here's how to do it - http://stackoverflow.com/questions/19465049/changing-api-level-android-studio Instead of changing it in the emulator, create a new Emulator, that'll be faster. – noob Aug 22 '15 at 12:09
  • @berry Just create an emulator which has a **lower or equal** API Level than the minimum required by your app. – Phantômaxx Aug 22 '15 at 14:56
  • @noob i created emulator of Android 4.4.2,platform 4.4.2 ,API level 19,CPU/ABI -ARM(armeabi-v7a).but i get alert Unfortunately Customer_Assist has stopped. – allDroid Aug 22 '15 at 17:33
  • @berry Have you changed it in the build.gradle file? If yes, what exception are you getting? Is it same as before? – noob Aug 22 '15 at 18:30
  • @noob i am using Eclipse for Android Native Development,so in this i dont have build.gradle file,so i created new Avd and run the emulator. – allDroid Aug 23 '15 at 07:48
  • @berry So the answer is even simpler, use Android Studio. It's officially recommended. If you choose to use Eclipse however, you can use AndroidManifest.xml for the same setting. – noob Aug 23 '15 at 07:52
  • @noob App is already written using eclipse i am just changing UI in that App.so Can i use the same App in Android studio,is there a Way?and in AndroidManifest.xml in eclipse setting could be done only in minsdkversion=8 and targetSDKVersion=19,as guided i changed emulator that have Android 2.2,API level 8 but its give same alert i have updated logcat please check – allDroid Aug 23 '15 at 08:36