Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ADB commandline Hanging during install (PhoneGap)

My Phonegap app refuses to load onto my Android device (even the HellowWorld default app is refusing to load)

Everything was running just great until today. Here's my console log:

***\>adb devices
List of devices attached
4c05609b        device

***\>phonegap run --device -V android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] compiling Android...
[phonegap] Generating config.xml from defaults for platform "android"
[phonegap] Compiling app on platform "android" via command "cmd" /c ***\platforms\android\cordova\build
[phonegap] Platform "android" compiled successfully.
[phonegap] successfully compiled Android app
[phonegap] installing app onto device
[phonegap] Generating config.xml from defaults for platform "android"
[phonegap] Running app on platform "android" via command "cmd" /c ***\platforms\android\cordova\run --device

It just sits there saying running... forever.

I have another terminal window open with adb logcat running and at some point (maybe 10-15 seconds into that last line getting printed) it stops logging. Termination of the process and subsequent calls to adb logcat result in more hanging (no logging at all)

So then I have to do a kill-server, start-server to break out of this endless hanging at which point the phonegap process terminates with:

       [error] An error occurred while running the android project.
***\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
ERROR: Failed to launch application on device: ERROR: Failed to install apk to d
evice: Error executing "adb -s 4c05609b install -r "***\platforms\android\bin\Po
ached-debug-unaligned.apk"": protocol failure

I have tried::

  • deleting my .cordova folder in C:\Users\Name
  • running the adb install directly (without phonegap)
  • deploying to an emulator (same problem)
  • unplugging / replugging the device
  • rebooting all devices
  • toggling "developer mode" on the device and revoking USB debugging privileges

I am all out of ideas!

Would greatly appreciate any tips or leads.

ADB version 1.0.31

Galaxy S3 running Android v4.3


EDIT:

Deploying to an emulator claims to complete successfully, but the app never opens and does not appear in the app list inside the emulator. So I have no way of actually testing it on the emulator either.

Would really appreciate some assistance.


EDIT 2:

After some further tinkering I've discovered my issue can be more specifically described as ADB hangs (freezes) when I attempt to talk to my device. I've determined this because adb shell, adb install, and adb push all fail the same way as described above. No error, just finite waiting.

adb logcat, adb devices, and other read functions work perfectly fine until one of the aforementioned write functions hangs in which case I need to do a adb kill-server or TASKKILL to get adb logcat working again.

Not sure if this added information helps, but there you go. The last thing I haven't yet tried is to do a factory reset on my phone as suggested by this fellow. If I can't find a solution soon I will back up my data as best I can and attempt this...

Please save me before this becomes my last option!

like image 411
isick Avatar asked Jan 22 '14 23:01

isick


1 Answers

The issues seems to resolve itself randomly. As others suggested, an arbitrary combination of ADB kill-server, restarting the device, and re-installing SDKs seems to alleviate the problem (even if only for a couple pushes).

I still have no idea what causes this hanging and, though superstitiously believe the arbitrary combination described above fixes it, am unsure how to permanently resolve it.

To future people reading this, until a solid explanation is given my only advice is to square away an hour or so to restart / rebuild your dev environment... and make sure you buy a durable stress ball.

like image 137
isick Avatar answered Nov 15 '22 21:11

isick