How to fix "process is bad" error for an Android Widget?
NickName:wligtenberg Ask DateTime:2010-07-15T16:15:11

How to fix "process is bad" error for an Android Widget?

I have developed an Android Widget, and it was working fine. I added some extra functionality and pushed an update through the Android Market. Now people are complaining that it doesn't work anymore.

The error I see in the logs is:

07-14 10:33:44.016: WARN/ActivityManager(78): Unable to launch app ... 
for broadcast Intent { act=android.appwidget.action.APPWIDGET_ENABLED 
cmp=... }: process is bad 
07-14 10:33:44.026: WARN/ActivityManager(78): finishReceiver called 
but none active 
07-14 10:33:44.026: WARN/ActivityManager(78): Unable to launch app ... 
for broadcast Intent { act=android.appwidget.action.APPWIDGET_UPDATE 
cmp=... (has extras) }: process is bad 
07-14 10:33:44.036: WARN/ActivityManager(78): finishReceiver called 
but none active 

I have searched, but I cannot find anywhere what the process is bad error means, so I have no clue on how to fix it. Restarting the phone (or emulator) makes the error go away, however, that is not what I want my users to do. Could someone please help me to explain what the cause of the error is and how to fix it?

Copyright Notice:Content Author:「wligtenberg」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/3253676/how-to-fix-process-is-bad-error-for-an-android-widget

Answers
Allen Luce 2019-04-24T23:32:16

The \"process is bad\" is due to multiple crashes of the app (or BroadcastReceiver, Service, or other component). After a few of these the system decides it's fed up with that behavior and prevents the process from starting again.\n\nA reboot will clear the crash count but it can also be cleared by killing the system server:\n\nadb shell killall system_server\n\n\nThis will effectively do a \"soft reboot.\" I find it much quicker than an actual reboot.",


Record413123 2011-10-25T12:05:09

i got mine fixed like this:\n\nuninstall the application and install it again.\n\ni got this error when i installed a \"test\" application with the same package name and messed up something in the app cache data or somewhere.",


diptia 2012-03-13T11:13:33

I faced a similar problem . When I went through my code , I realized that it was the default values which were the culprit . Ensure that your default values are logical and positive.For instance ,if you have a background service starting at a particular interval , ensure that the default value you have set for the same is appropriate. ",


bbengfort 2012-04-19T13:36:06

The problem for me was also had to do with the XML- specifically I had a TextView element that did not specify layout_width and layout_height because they were inheriting a style that did not contain them. My styles.xml file was not validated for this by eclipse. When I ran the app I got the error that these views must be specified- when I fixed the error, I received the process is bad error, and had to Force Quit. \n\nUnfortunately I think that some settings were maintained, so rebuilding the app was not enough after the fix. I had to uninstall the app-- reboot the phone (to eliminate som persistent data) and when I reinstalled I recovered from the error.",


Victor Basso 2014-01-21T18:56:17

Happened to me when my BroadcastReceiver was repeatedly leaking an exception causing the system to kill my app.\nThe next calls to the receiver would result in the \"process is bad\" logs.\n\nThe solution in my case was making sure no exceptions leak from the BroadcastReceiver.\n\nThose are the logs when the app is killed (try looking for them and finding the cause):\n\nW/ActivityManager﹕ Process com.company.app has crashed too many times: killing!\nI/ActivityManager﹕ Killing proc 9344:com.company.app/u0a10239: crash\n",


abeboparebop 2015-05-18T05:26:37

Somewhat off-topic, but in some Android devices one can reproducibly cause this failure by writing an app which creates an UncaughtExceptionHandler in onCreate to restart the app after a crash, and then does something to cause an unhandled exception (either throw a RuntimeException, or do something that causes an NullPointerException, or whatever). Some example code is given below.\n\nI have tried this on two devices: a Samsung Galaxy Tab 2, and a Verizon Ellipsis 7. With the Tab 2, I couldn't cause the issue while I was running the app from Eclipse -- it would crash and restart repeatedly and never be killed. Instead, I had to export the app to apk, install via adb, start the app, and after 4-8 crashes and restarts, Android would kill the app with the error message above (Process com.buggy.app has crashed too many times: killing!).\n\nWith the Ellipsis 7, I was never able to reproduce the issue. The buggy app would repeatedly crash and restart, and the OS never killed it even after 10 minutes of this.\n\nSample code for repeatedly crashing app:\n\npublic void onCreate(Bundle savedInstanceState) {\n mContext = this.getApplicationContext();\n\n UncaughtExceptionHandler uehandler = new Thread.UncaughtExceptionHandler() {\n\n @Override\n public void uncaughtException(Thread thread, Throwable ex) {\n\n // restart app after 100 milliseconds\n PendingIntent myActivity = PendingIntent.getActivity(mContext, 0,\n new Intent(mContext, MyActivity.class),\n PendingIntent.FLAG_ONE_SHOT);\n AlarmManager alarmManager = (AlarmManager) \n mContext.getSystemService(Context.ALARM_SERVICE);\n alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + 100,\n myActivity);\n\n System.exit(2);\n\n // re-throw critical exception further to the os (important)\n Thread.getDefaultUncaughtExceptionHandler().uncaughtException(thread, ex);\n }\n };\n Thread.setDefaultUncaughtExceptionHandler(uehandler);\n\n throw new RuntimeException(\"Crash the app!\");\n}\n",


mobibob 2010-10-09T03:33:47

I am having the same problem and my current theory is that the appWidget crashed and when it was restarted it had the same bad persistent data that made it crash each time it was restarted. When this happens too often, the appWidget is \"force stopped\" by the OS. My band aid is to have a touch event that is \"setOnClickPending\" that the user will touch (out of frustration if necessary) and that will be processed internal to the appWidget and reset the appWidget.",


Mitulát báti 2015-06-26T14:23:23

I had the same problem. I got to a point where restarting and reinstalling the application didn't solve the problem. I was frustrated. I removed everything from the class that extended AppWidgetProvider, and run the application with only two empty methods in it: onUpdate and onReceive. Finally solved the problem.\n\nMaybe it will not solve yours, but who knows. Give it a try.",


NPike 2010-07-20T02:31:37

I just experienced this myself right before packaging for the market place. I was following the guidelines and added the android:label=\"@string/app_name\" attribute to the application element in my manifest...\n\n\nUninstall your app\nReboot phone/emulator\nPush new app without this attribute\n\n\nViola! Works for me now! \n\nEDIT: To match comments.",


sorry_I_wont 2019-09-09T21:03:01

This worked for me!\nChange your implicit intent to explicit intent, because starting Oreo implicit intents don't run in background!\nSo basically when creating your Intent object, pass in the class name you want to start.\nhttps://developer.android.com/about/versions/oreo/background.html",


Dan J 2012-02-16T22:28:56

I hit a process is bad error on my HTC Sensation OS 2.3.4 after removing the INTERNET permission from my AndroidManifest.xml.\n\n\n W/ActivityManager( 253): Unable to launch app\n MY_DOMAIN.flashback/10132 for broadcast Intent {\n act=android.intent.action.PHONE_STATE flg=0x20000000 (has extras) }:\n process is bad\n\n\nI carefully tried lots of different workarounds, and I found the only way to fix was:\n\n\nUninstall the app through Settings -> Applications.\nRemove the battery from the phone (using the Android \"Power off\" menu did not work).\nTurn device on again.\nInstall the APK again using adb install <myapp>.\n\n\nI want to take this opportunity to list what did NOT work for me (as there seems to a lot of FUD about how to fix this error):\n\n\nUninstall app, reboot using Android phone menu (press and hold on button and choose \"Power off\"), turn on again, reinstall.\nUninstall, use adb kill-server, then adb start-server, reinstall.\nUninstall, run adb shell then ps, this didn't show my app running at all.\nUninstall, do a clean build in Eclipse, reinstall.\n\n\nI wonder if the underlying problem was caused by my app getting smaller in size. I think it used to unpack to flashback-1.apk and flashback-2.apk on the device, whereas now it is only unpacking to a single flashback-1.apk.",


tsinyun 2012-09-02T14:40:03

I just get this error. \nI fix the error and I remove some source code invoking from OnConnectionReceiver.onReceiver(), Maybe the invocation will cost some time.",


Jacob L 2012-10-05T13:34:23

I faced this problem. the reason was that the WLAN call wifi.getConnectionInfo().getScanResults(); could return a null instead of an empty list in some occations. I found this after logging the logcat for several hours. When the application encountered an error and crashed, a touch on the widget would give me the same \"bad process\" error you mention here as the intent did not reopen the app, but it gets stuck in a crashed state. Guess it it just the way Android deals with a crashed widget.",


More about “How to fix "process is bad" error for an Android Widget?” related questions

How the type `Fix` and function `fix` are same in Haskell?

I'm trying to convince myself that type Fix and function fix are the same thing. But I can't find the correlation between their definitions -- definition of fix fix :: (p -&gt; p) -&gt; p fix f = ...

Show Detail

How to fix Lint problems with --fix in Firebase Functions

I'ved got a firebase Function code that has quite a lot of Lint problems. How can I fix these with --fix. It was shown at the end of the error message. firebase deploy /Users/xxx/firebase/functions/

Show Detail

How to fix this AttributeError?

I installed a stripe package yesterday and now my app is not running. I am trying to understand where the problem is. Is it something to do with PyShell or HTLParser or something else. I am posting...

Show Detail

How to fix this template:

template &lt;typename IN,typename OUT,bool isVector&gt; OUT foo(IN x){ if (isVector){ return x[0]; } else { return x; } } After asking this question I wrongly assu...

Show Detail

How to fix QGraphicsScene?

How to fix the QGraphicsScene? I mean, how to disable auto centering? When I try to move an object along the X axis to the right, and then return it to the left by the same axis, the center changes...

Show Detail

How to handle recursion in FIX?

Imagine a situation where you need to have recursive data structures, like trees, represented in a FIX message. How would you do that? I could represent a data structure in JSON like this: { { ...

Show Detail

How to implement a class with FIX types

Here is a working code #include "quickfix/FixFields.h" #include "quickfix/Values.h" int main() { FIX::BeginString beginString(FIX::BeginString_FIX42); return 0; } It compiles and if I

Show Detail

Not sure how to fix this bug

I am trying to convert some less to sass and can't understand how to fix the following bug. This isn't my code it's a clients and I have no clue what they are trying to do. Could someone please he...

Show Detail

A FIX msg is broken into 02 parts. How to link these broken set of FIX msgs to make it a complete FIX msg?

Lets say, we get the FIX messages from upstream system in the from of XML messages. But these messages are broken into 02 xml messages. All this msgs in xml format is stored in a table. Now, we have

Show Detail

How to fix requireShorthandArrowFunctions

How to fix this requireShorthandArrowFunctions arrow function so that it is compliant with JSCS? const doSomething = () =&gt; { return new Promise((resolve, reject) =&gt; { resolve('s...

Show Detail