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!
In case this helps others I had a problem with similar symptoms. ADB install -r "apk path" would hang indefinitely.
I troubleshooted a myriad of things and identified that it was my USB cable length.
I have an USB extender cable as that I plug my devices into. The combined length of my device's cable and the USB extender cable caused this issue. Removing the extension cable fix the issue and eventually I replaced my USB extender cable with a shorter extension cable for the final solution.
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.
Shot in the dark here, but some more things to try:
Are you on a work PC or something? Make sure you have USB write permissions. Also, try different USB ports and cables. You have the latest USB driver for your devices right?
Try updating the SDK tools. Or maybe something got corrupted and a re-install might do the trick.
You have free space on your devices right?
Unknown sources is checked on both devices?
What version of Android are you targeting?
Do try restart the device like other suggested. From my experience, kill the adb process, then run the cordova run command helps magically sometimes.
In my case adb seemed to hang, but in fact the data transfer from Mac to emulator was really slow:
$ adb push platforms/android/build/outputs/apk/android-debug.apk /data/local/tmp/
150 KB/s (15587200 bytes in 101.223s)
It's a lot faster on USB connected real device. Don't know why...
Had the same (original) issue (with cordova / testing on an old device) ie. hang during install.
Tried running adb install directly from cmd line ...
adb [-s <deviceID>] install <apk>
...and same issue so not cordova specific....
Opened android device monitor (ADM) ...
..sdk\tools>monitor
..and ran install from cmd line again and saw logcat message saying package was sdk 16 / device was 15...doh!
So went back to AndroidManifest.xml and changed android:minSdkVersion to 15 and all back to normal again - install worked fine.
( Issue arose because I had installed something else which had changed the minSdkVersion and then removed the something else and never reset the minSdkVersion )
So, possibly device sdk / android version is too low for your build. If not, a look at the ADM logcat output as you initiate the install from the command line might indicate what the issue is.
Unplugging and plugging device again usually helps.
Related
I have a flutter app that I debug on real device, and it runs fine in the debug mode.
I got to a point when I created a backend server that runs in a localhost:8080 only machine, so in order to make it accessible from my real phone device also, I ran:
adb reverse tcp:8080 tcp:8080
and it worked exactly as I expected where the app was running.
But, after this, if I re-rerun the app again in the real device ( unplug and plug again the USB in the machine ), it got to the point of showing the √ Built build\app\outputs\flutter-apk\app-debug.apk. and this error got thrown and it terminate/close the debug process of the app :
Error connecting to the service protocol: failed to connect to http://127.0.0.1:61410/DHX5GEb2kn4=/
I did try to kill the adb.exe command with:
adb kill-server
supposing that this will undo the adb reverse command but the same error gets thrown
well, I found a painful fix, which is restarting the device, but this takes much time and is painful.
I want to know what should I turn on/off while debugging my flutter app
I finally managed to fic the issue, and get my app debugging properly again.
What I did wrong ?
When I needed the adb, I thought it's not installed on my laptop since when I runned adb command in command line tool (cmd), it tells me that it's not recognized, so the smart me did downloaded the android platforms-tools separatly from Here
, and I runned the :
adb reverse tcp:8080 tcp:8080
from it's folder, which runned, and I thought I solved the issue, but what I just learned is that the Dart VM server uses an internal installed another adb.exe which have a different version (39) that what I run the command with (41).
so when I re-debug the flutter project, the error happens.
How did I fix it?
I did simply searched for the internal adb.exe, you can find in the Android folder, ...\Android\SDK\platforms\tools\adb.exe.
I Paste the new adb.exe with the height version inside the folder.
Run the command from that folder
For 3., you can set the path of that folder in the PATH in environment variables, so you can run the adb commands from anywhere.
I am stuck in a problem here.
I cannot attach debug using Android Studio 3.5.1.
Its keeping showing me the message "Error running 'Android Debugger (8600)': Unable to open debugger port (localhost:8600): java.io.IOException"
I tried a lot of things like:
adb reset
invalidate
restart windows
reinstall android studio
and none of them works.
And I cannot find Enable ADB Integration on this version.
Anyone knows how to fix it?
EDIT
Debugging with emulator is working with all versions.
Debugging with devices is working only with devices with Android 9.0+
Kill and start adb didn't work.
I dont think its a local problem because its happen with a lot of people here. Its seems to be a project problem
You might check this 3 things:
1.
Youre not running a not debuggable version.
android:debuggable="false" in Android Manifest
2.
In Android studio you re not building a release version
Check in Build variants in bottom left corner.
3.
If nothing works use Troubleshoot device connections
Tools -> Connection Assistant
or older version
Tools -> Troubleshoot device connections
And try out the helper page from google (seems for older versions)
https://developer.android.com/studio/run/device#assistant
Try this:
adb kill-server
adb start-server
adb usb
For linux, e.g., ubuntu: start all commands with sudo like this:
sudo adb kill-server.
its your connection issue, cant find your device DNS.
what is your OS ?
In windows:
you must go to network and find duplicate dns and clear it (Search for
it)
In mac:
you must kill adb or delete that and run a new version
last hit is Update emulator in sdk
.First you need to check your build.gradle(app) file , and ensure that your build is debuggable.
.If debuggable then you need to check adb is working or not in your system, you can
check by just press 'adb' .
if its working then check devices by 'adb devices', it will show all connected devices.
add kill-server then enter and adb start-server
Try this. I have had luck with this approach when I run into problems with adb.
You can check if the device is recognised or not using
adb devices
If it is indeed recognised you may try to kill adb and start it again
add kill-server
adb start-server
Until yesterday everything was working perfect until today that I connected my phone (just updated to Jelly Bean) and adb.exe stop working. If I execute adb.exe I can see the help but when I want to use any command it just run forever and no message is shown.
I tried with "kill-server" and "devices" and it runs forever, no message at all is displayed and I must terminate the process to close it.
I just connect the same phone to other PC that was fully functional and also adb.exe stop working. The strange thing is that adb.exe will not work any more even If I disconnect the phone and/or I connect my tablet. Adb.exe just got useless.
I was using the same phone yesterday (android 4.0), with my tablet (android 4.2) and adb.exe was working.
Adb.exe is not corrupted as I checked it MD5 and it is the same as in working pc (5787e5df1a68e7afea82d58e5f0d6549 *adb.exe).
I have Android Debug Bridge version 1.0.31 and Android SDK tools 22. I uninstalled android sdk tools and Installed again but when is near to finish it hangs because it launches adb.exe and again it will run forever.
Please any suggestion or help?
Try rebooting. Sometimes the USB drivers lock up. I work HEAVILY with ADB in my project at http://android-casual.googlecode.com and I find it to be one of three things when ADB locks up.. 1. USB drivers, or 2. adb_usb.ini needs an update, or 3. on new devices you have to "pair" them so that ADB can perform any action.
To pair, you can disconnect, reconnect and run "adb devies" to display the pairing on the device.
Not sure if you're still facing this issue, but for what it's worth I had the same kind of issue with adb.exe, and came across this post while trying to troubleshoot it. In my case, I wasn't using any physical Android devices, only the Emulator. Everything had been working fine and then suddenly adb.exe would no longer respond (couldn't get any output from any adb command - it just appeared to hang).
In the end, my issue turned out to be another application I had installed on my development machine. It was starting as a service, and was listening on the exact same port that the adb server runs on (5037), which appeared to be confusing it. Once I changed the application to use a different port, adb started working again and everything was fine.
Run command
where adb
I had such kind of situation.
In my case
where adb
gave output
C:\Windows\adb.exe
D:\AndroidSDK\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.exe
I tried to run adb from disk C, when Eclipse used second adb from AndroidSDK (from disk D).
I removed adb from strange path C:\Windows\adb.exe, and this solved this problem.
I got the same problem,my solution is going to cmd and paste adb.exe path,and then click enter button.For example
D:\Android\Android\platform-tools\adb.exe
A few days ago I started having troubles while trying to install a .apk on my Galaxy S2. I select my phone as the target, click OK and in the Console get the following error:
Failed to install AvatarRun.apk on device 'device number': timeout
Launch canceled!
Without changing anything in code and running again I can also get the error:
Failed to install AvatarRun.apk on device 'device number': device not
found com.android.ddmlib.InstallException: device not found Launch
canceled!
I have tried opening a command window and navigating to android-sdk\platform-tools and running:
adb kill-server adb start-server
This did not fix the issue.
This seems to just be a coincidence, but after failing many times I changed the minimum SDK in the Manifest from 10 to 7 and the .apk loaded on the next try, but has worked intermitently since and generates the same errors.
Can anyone suggest a method for finding what is causing this error?
After trying the fixes mentioned above, I ended up installing and reinstalling the Galaxy drivers. This didn't help. What eventually worked (so far) was to switch which USB port the Galaxy is plugged into. Once I did this everything was functioning as it should.
It may sound ridiculous, I tried all the ways suggested in Android error: Failed to install *.apk on device *: timeout
None of them works for me except unplugging the current cable and change for a new one.
There are various solutions:
Try changing the ADB connection timeout. The default is 5000; you should change it to 10000ms or so.
Window -> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)
Try to unplug and re-plug the cable. It seems that sometimes Eclipse loses the connection with Device. Sometimes you just need to plug into other USB port.
You might need to kill the ADB process and restart it.
adb kill-server and then
adb start-server
For me, the solution is to uninstall the old apk from the phone.
This problem often shows up if the computer is not fast enough. So,if you go to task manager you will see the performance. If you are watching video or running other programs at the same time while you are running your android application close other programs; at least during installing the app on device or emulator. You might even need to close internet browser.
You might need to update your computer to make it faster if you can.
Hope this helps someone:)
I've been developing my first android apps on Eclipse installed on OSX Lion. I would like to use my Jelly Beans Galaxy Nexus for debugging, but the Android Device Bridge (adb) can't find the device:
./adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
The phone is in debugging mode.
The phone is recognizable as a camera (PTP), but not as a media device (MTP). ADB does not work regardless of PTP\MTP setting.
I have restarted noth the phone and the mac
Following this advice, I've installed Android File Transfer. The ATF recognizes the device, but no luck with the ADB.
Any ideas?
Addendum: I have reported a bug for this. Workarounds are still most welcome!
Sep 5 13:28 UTC - Workaround #1: Dropbox: I've moved the OSX Eclipse workspace to Dropbox and installed Dropbox on the device. The APK is written to bin/, and I re-install it from the Dropbox app after each successful build.
I'm answering this because my boss just had the exact same issue with his Galaxy Nexus, and we finally fixed it yesterday. He had an application, "EasyTether" that was snagging his connection to ADB and it couldn't be used anywhere else. Is it possible that you've setup this application, or a similar one that might be using ADB for you? If "Android File Transfer" works (it was working in parallel with EasyTether for my boss), then your connection is active, so as long as "USB Debugging" is enabled in your settings, you should be seeing a connection. Here's a quick how-to in the event that you do have "easytether"
BEFORE you plug your phone in run the following in terminal
sudo kextunload /System/Library/Extensions/EasyTetherUSBEthernet.kext
If that fixes the issue, and you want to remove easytether altogether, you can us the rm command with the -rf flags to keep it from happening again...
sudo kextunload /System/Library/Extensions/EasyTetherUSBEthernet.kext
sudo rm -rf /System/Library/Extensions/EasyTetherUSBEthernet.kext
You can use adb over wifi.
See this post to do it yourself.
or there are quite a lot of apps on google play. But these need root access
Try taking the usb stick out of the phone and put it back
Try taking it out of the mac and put it back
Try to put the stick in another port
Try to wriggle the stick so you are sure it is connected.
There is a long discussion with possible solutions here: Can't find android device using "adb devices" command
Have you tried a different cable? I ordered a bunch of cheap cables off of eBay, and the first one I used would not work for adb. It did work for charging and file transfers however.