2

I'm debugging an Android app on an HTC tablet and every time I uninstall the app, the device reboots. Uninstallation also happens as part of trying a new build, so any changes to the app require a reboot before testing. This is predictably aggravating for development.

The problem sounds similar to that described here except that there's no mystery about it in my case. Uninstall => reboot. Change app and debug through Eclipse & adb => reboot. Wiping all the data on the device as suggested in the only answer to the similar problem is not desirable, especially as there's not much indication that even that poster saw it as anything other than the tech equivalent of sacrificing a chicken.

Can anyone tell me why this is happening and how to prevent it?

Community
  • 1
  • 1
blahdiblah
  • 33,069
  • 21
  • 98
  • 152
  • does it make a difference if you uninstall it in different ways? i.e. ADB or manually on the device – FoamyGuy May 04 '12 at 01:32
  • Nope. Manual uninstall via dragging to the trash and `adb uninstall ` both result in reboots. – blahdiblah May 04 '12 at 01:34
  • What device is it? Does it reboot when you uninstall other programs too? or just the one you are working on? – FoamyGuy May 04 '12 at 01:37
  • It's an HTC Flyer P510e running Android 3.2.1. Other apps that's I've tested uninstall without a reboot. – blahdiblah May 04 '12 at 01:40
  • First its not your fault, though with detailed understanding you might find a workaround. What sort of operations does the app do? Is it published? Can you Make a minimal version that still crashes, to post? Does it crash if you install and uninstall without ever running? Is the device stock, without mods/rooting? – Chris Stratton May 04 '12 at 02:10
  • The app displays local pdfs and some simple webviews. It's not yet published. The device is stock. (I'm assuming s/crash/reboot/g.) Because there's no particular part of app that's clearly connected to the rebooting, it would be a lot of work to go through removing pieces at random to see if they had any effect. It does **not** reboot after install/uninstall without ever being run. Hmmm... – blahdiblah May 04 '12 at 02:24
  • I've seen that problematic sync adapter configs can cause reboots, does your app declare a sync adapter. – superfell May 04 '12 at 02:55
  • No sync-adapters, just a few activities and a couple authenticator services. – blahdiblah May 04 '12 at 03:03

1 Answers1

1

I'm not offering this as an answer (at least not yet) but need more space than a comment provides to brainstorm about how to investigate this

I'd be tempted to take a safe "hello world" type app and merge it into the project as its own activity. Then comment out all the real functionality from the manifest and java files. That should leave only the hello world and the resources. See if the device survives uninstalling that after a run - if not, guess you might have to suspect the resources.

This should do the commenting - or you could just remove files wholesale from the tree

find  . -name "*.java" | xargs -I f sed -i 's/^/\/\//' f

(Some editors will do block comment/uncomment, emacs will do arbitrary operations on a column of a file.)

Then I'd either uncomment the skeleton of the real activity - ie, all the onCreate, onStart, etc methods with no operations in them, and restore that activity to the manifest. Or else I'd restore functional java code, but leave the activity out of the manifest. You could then incrementally add more and more functionality until you get a crash.

If you have any ndk libs or even java libs you could play a similar game with those.

You can also try to run logcat during the uninstall and see if any messages make it out before the device hangs up on you.

Oh - and a major question, is this a kernel reboot, or an android runtime restart? In the later case, adb & logcat should probably survive, and /proc/uptime will not be reset to a small number.

If you get it down to a suspect operation, it would be great if you could post a description of that - I have a similar device in my test collection and would be curious to see if it has the same apparent bug. Also HTC has a number of "Developer Evangelists" who might be a point of contact.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117