How to fix "process is bad" error for an Android Widget?
I hit a process is bad
error on my HTC Sensation OS 2.3.4 after removing the INTERNET
permission from my AndroidManifest.xml.
W/ActivityManager( 253): Unable to launch app MY_DOMAIN.flashback/10132 for broadcast Intent { act=android.intent.action.PHONE_STATE flg=0x20000000 (has extras) }: process is bad
I carefully tried lots of different workarounds, and I found the only way to fix was:
- Uninstall the app through Settings -> Applications.
- Remove the battery from the phone (using the Android "Power off" menu did not work).
- Turn device on again.
- Install the APK again using
adb install <myapp>
.
I 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):
- Uninstall app, reboot using Android phone menu (press and hold on button and choose "Power off"), turn on again, reinstall.
- Uninstall, use
adb kill-server
, thenadb start-server
, reinstall. - Uninstall, run
adb shell
thenps
, this didn't show my app running at all. - Uninstall, do a clean build in Eclipse, reinstall.
I 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
.
Happened to me when my BroadcastReceiver was repeatedly leaking an exception causing the system to kill my app. The next calls to the receiver would result in the "process is bad" logs.
The solution in my case was making sure no exceptions leak from the BroadcastReceiver.
Those are the logs when the app is killed (try looking for them and finding the cause):
W/ActivityManager﹕ Process com.company.app has crashed too many times: killing!
I/ActivityManager﹕ Killing proc 9344:com.company.app/u0a10239: crash
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.
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...
- Uninstall your app
- Reboot phone/emulator
- Push new app without this attribute
Viola! Works for me now!
EDIT: To match comments.