I've recently started encountering problems while trying to run my application from Android Studio on my MacOS machine. I tried to run the command from adb myself but I still can't get it to work, although the error appears different.
The errors I get are as follows;
Android Studio
10/02 09:54:53: Launching app $ adb push /Users/{username}/{path-to-apk}.apk /data/local/tmp/{package}
java.io.IOException: Broken pipe
Error while Installing APK
adb (via Terminal.app)
$ adb push /Users/{username}/{path-to-apk}.apk /data/local/tmp/{package}
adb: error: 65536-byte write failed:
Undefined error: 0
Now I've tried a lot of different things, some of which are just stretches because the problem appears to lie in something adb related, but none of this seems to change anything;
Different applications/apks
Different Android devices (total of 5)
Different USB-ports (all 4,
with and without USB-hub).
Different (or no) USB-dongles (USB-C to USB-A)
Restart/Invalidate Caches (Android Studio)
Reinstall Android Studio
Reinstall Android SDK
New (separate) install of Android SDK through homebrew
Reset NVRAM/PRAM
Reset SCM
Update to MacOS Mojave (and retry all of the above).
At this point I am at a loss. Has anyone encountered these errors before without having any of the above solutions fix it? Next thing on my list is a reinstall of the OS, but that feels like a bit of overkill.
I am running on MacOS Mojave on a 2016 Macbook Pro, but everything appeared to have the same effect on High Sierra.
Edit
Weird update on the behaviour, I can get the installing to work continuously after a restart by doing the following steps;
Login
Start Terminal.app
Manually repeat adb push command
(Command executes successfully)
Start Android Studio
Everything works fine...
However, if I start Android Studio without first manually doing the adb push in Terminal, everything is broken as described above.
Edit 2
Even calling adb start-server in Terminal before starting Android Studio makes everything work. So something appears to be faulty when Android Studio is responsible for starting the adb server..
I got the same error. I have no idea but start-server before starting Android-studio
Restart adb with the following command,
adb kill-server && adb start-server
Not really an answer but my issue appears to be solved with the latest release of Android Studio.
Related
After installing i get a Disconnected emulator-5556 message, while im running a different emulator (on 5554).. Even when i don't have any emulators of devices running!
I tried deleting all my AVD's
Wiping AVD data
adb kill-server && adb start-server
AS restart
Created a new user profile on my Mac to see if that helped..
Re-installed SDK Platform tools
When i launch my app via run. The device selector shows this. Is this way since a long time and didnt interfere with my work in AS 3.2. But after upgrading to AS 3.3 i cant run apps anymore
But nothing works, anyone ran into this issue before?
For if someone runs into this in a couple of years. I tried a couple of commands and the ghost emulator magically disappeared...
First command (to see if a process is doing something with adb)
ps aux | grep adb
Second command (to see if files are opened by a process)
lsof -nP -i4TCP: 5556 | grep LISTEN
Shouldn't have worked, but it stopped the blinking emulator for me..
No worries, just go to SDK manager and check if the Update is Available for the SDK Platforms, or SDK Tools. this usually happens when we use previous versions and sudden date to the new version of android studio and tools or platforms are not ready or updated with that version. Android has the version compatibility issues.image
I had the same issue after upgrading to Android Studio 3.3. In my case I had the Videostream app on my Mac and it was competing for port 5556. Uninstalling /Applications/Videostream and killing the process freed up port 5556 and everything started working for me again.
I'm creating an application in android studio but I am um able test it on the virtual emulator because the adb process won't start. It's giving this error.
I tried manually starting adb and all other things but this happens.
I tried reinstalling android studio and platform tools. I downloaded a separate adb and ran "adb start-server"/"kill server".
It just doesn't seem to work. So i constantly have to build the entire thing and generate apk to run it. Please help me guys!!!
Also regarding the virtual emulator i have intel haxm installed if that information was necessary.
It's may be because your emulator adb not allow the android studio to run on it and android studio try to stop and re-run but this process fail.
Me also the same problem. So i always follows this step and it's work for me.
1. Open android studio.
2. Try to run your app without opening your emulator(It will start your adb).
3. Then open your emulator and run your app.
It's working for me. May solve your problem.
adb server didnt ack. This issue will resolve ussually when you kill all instances of adb.exe and restart server again.
Open Task manager and kill all adb instances and start server again.
Try the following:
Close Studio.
End adb.exe process in taskmanager.
Issue kill and
Run adb kill-server
Run adb devices
Then start the emulator and try adb devices again. This should list your emulator-device.
Run you apk in studio.
If your are using Genymotion,try to link your Android Studio 's SDK to Genymotion Android SDK Path.Then try to type with adb devices, I hope this will help for you.
My ADB install does not work, it does not start or show any info. I keep getting the same error message over and over again:
18:14 Unable to run 'adb': null
18:14 '/Users/jorandob/Library/Android/sdk/platform-tools/adb start-server' failed -- run manually if necessary
If I try to start ADB manually it just doesn't show anything.
I tried so far:
Restart server
Reinstall ADB
Reinstall Android Studio
I'm on mac os X 10.11.6 and not using any special emulator.
If its helpful information, I'm using ionic.
Terminal ADB:
Jorans-iMac:~ jorandob$ adb version
Android Debug Bridge version 1.0.36
Revision 0e9850346394-android
I finally resolved my issue, it occurs if you run java and ADB at the same time.
to fix it stop all java processes in the activity monitor.
I've seen many posts with a similar problem and tried many solutions but so far none have helped. This all started after I upgraded Genymotion from 2.5.2 to 2.6.0.
I'm using Android Studio 1.5.1 on Ubuntu 15.10 64 bit. The Genymotion plugin is version 1.0.7. VirtualBox is 5.0.12 r104815
When I try to start a Genymotion Emulator I get:
I have several machines defined and all do this.
However, I can start them from the Genymotion app.
One other piece of information...if I have Android Studio and Genymotion running I get the following error when I try to issue any adb command from the command line:
adb server is out of date. killing...
cannot bind 'tcp:5037'
ADB server didn't ACK
* failed to start daemon *
error:
I've tried restarting the computer, restarting Android Studio, and removing and reloading the plugin. I've also set Genymotion to use the same adb that Android Studio uses.
Any ideas? Let me know if you need more info.
Thanks,
Rich
This is actually 2 separate problems and I've found the solution for one and a workaround for the other.
Can't start Genymotion Emulator from Android Studio Plugin - I resolved this for now by reverting to Genymotion 2.5.2. I'll still need to figure out why 2.6.0 causes a problem but for now I can start emulator machines from the Android Studio plugin.
adb server is out of date - This is caused by more than one instance of adb on the machine. In my case, Android Studio was using the one in ~/Android/Sdk/platform-tools, but when I tried issuing adb commands in terminal it was using the one in /usr/bin. I'll either try creating a symbolic link in /usr/bin to point to ~/Android/Sdk/platform-tools, or I'll add ~/Android/Sdk/platform-tools to my Path environment variable.
Rich
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.