I'm working on Phonegap for few days. Before this I was able to run phonegap apps into emulator through command line successfully, but now that's showing a peculiar hang; nothing happening no error, no flow of execution.
Now I'm running my apps by installing the .apk file directly through Android command line. But, still I want to know why it's not working, why this run command hangs there?
In my case ADB DEVICES displayed me invalid devices, an ADB KILL-SERVER solved this for me.
i suspect that is was caused by a my laptop going into sleep mode.
when it says trying to install app onto device the command is actually running adb install C:/yourpath/yourapp.apk which copies the app the android installation.
You shouldn't worry if it takes a long time. The installation is proceeding as planned, just be patient. The bigger your app, the longer is takes. For me a ~300MB app takes a full 7 mins to install to an attached device via USB. And the same app will take 13 mins to install to an Android emulator.
The emulator is known to be slow, there's a big SO thread regarding this issue here - Why is the Android emulator so slow? How can we speed up the Android emulator?
Related
I recently updated my android studio to 3.4.2. Until that point, everything was working perfectly fine.
But after I updated and made a few changes in the code I ran the app but unfortunately, the app does not get installed on my device anymore, it stops as soon as the build is completed.
Things I tried doing to solve the issue:
1. Restart the android studio
2. run it several times
3. kill and start the ADB
Launching app
$ adb install-multiple -r -t F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_9.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_0.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_6.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_2.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_5.apk F:\achuth\khelo\app\build\intermediates\resources\instant-run\debug\resources-debug.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_3.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_4.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_7.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_1.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\slices\slice_8.apk F:\achuth\khelo\app\build\intermediates\split-apk\debug\dep\dependencies.apk F:\achuth\khelo\app\build\intermediates\instant-run-apk\debug\app-debug.apk
Device emulator-5554disconnected, monitoring stopped.
Split APKs installed in 32 s 703 ms
Close Android Studio and Delete the cache in /System/Caches is useful for system
Any help on this would be appreciated.
I've been researching about this adb error and the different solutions posted aren't working for me.
As the titles says, when I execute on cmd: adb devices it shows up for 1 sec a new command prompt without any information and at the end it returns to the original cmd window without any results of the device connected to my computer.
Some days ago it was working fine until some awful windows updates were installed and I began to experience this sdk problems.
Also, with this problems I've been facing it's very difficult to run Appium which is my goal right now to make some automated tests on Android devices.
PD: I've installed-reinstalled the SDK, Java, Eclipse, etc.. The
system variables are added on the PATH. I run the programs as an
admin too. SDK manager is up to date with the updates.
Thank you everyone for your help and support.
Regards.
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.
Ok, I have created and run various Cordova apps in the past, but since the last 2 weeks I have more and more issues with getting any app to install on my device. I have an LGE975 (LG Optimus G) phone, and there are already 5 Cordova apps installed on it.
Sometimes if I just try it 20 times it will work. Today however I have tried to run apps I don't know how many times, but they just won't install, and no error is thrown.
What I've tried so far:
Reinstalling Cordova
Upgrading cordova from 3.1.0-0.1.0 to -0.2.0
Downgrading back to -0.1.0
Rebooting device
Rebooting pc
Running app on platform "android" via command "cmd" /c C:\CordovaProjects\HelloW
orld\platforms\android\cordova\run --device
Buildfile: C:\CordovaProjects\HelloWorld\platforms\android\build.xml
What is it doing during the installation on device? The verbose output of Cordova isn't showing much of where it could go wrong. Also no error is thrown.
Is there anything I can do to fix this?
As suggested in the comment aboive i just runned:
platforms\android\cordova\run --device
and it worked!
It must be a bug or something.
I had the same problem, but it worked when I launched the process from an Administrator command prompt.
(On windows 7, Start -> Search Programs and Files -> type "cmd" -> Right-click on CMD -> Run as Administrator -> run phonegap command)
This is sort of a 'duh' answer, but maybe its an android version update that was applied to your device (phone) and the OS is now slowing things down?
Or, maybe your device is really full on storage space, and you should free up some space to speed things up :)
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