Android Studio on Mac OS X adb connection - macos

I'm using Android Studio (1.0.2) on Mac OS X (10.10.2). I can use Eclipse with adb with no problems on my system. However, Android Studio has problems connecting to adb. The first run it works. It seems that after a certain amount of time (20 - 30 secs?) adb quits unexpectedly. Then I get the message ADB not respoding in Android Studio. Manually killing and starting adb from a terminal sometimes fixes the problem but usually makes my device (Samsung Galaxy S5) invisible to adb. There is only one adb on my system (version 1.0.32) installed.
Doing an lsof -i :5037 shows a list of 9 connections from Android Studio, all from localhost, all CLOSE_WAIT but one which is ESTABLISHED. In a working situation there are also four of them from adb, one of them LISTENING on port 5037.
I have my firewall turned off. Exiting Android Studio crashes adb one more time. Restarting it sometimes allows me to continue working, sometimes it changes nothing.
Unplugging and plugging back in my device fixes the device visibility.
Please advice what to try next because this setup is pretty unusable at the moment.

Related

Asus Laptop Unable To Pair With MacBook Air In Visual Studio, "An unexpected error occurred while checking the SSH configuration..."

This is an error I have only observed with the two machines I mention in this issue - an Asus Q406DA AMD Ryzen 5-based laptop running Windows 11 (issue occurred with Windows 10 also) and a MacBook Air running Big Sur (2020 machine). I do not observe this error connecting with Dell desktop systems with Intel processors.
All I'm trying to do is to connect/pair the Windows 11 laptop over a network connection (wireless or ethernet; doesn't matter, symptoms are the same) to the MacBook Air using the "Pair To Mac" feature in the toolbar to allow Xamarin to remotely utilize the Mac as a server for generating executable iOS code and run on an iPhone connected to the MacBook Air.
Upon clicking on the "Pair To Mac" toolbar button, the Pair To Mac dialog window appears, recognizing the MacBook Air on the network at a particular IP address. Double-clicking on the Mac entry, or right-clicking on the entry and clicking "Connect...", or clicking the "Connect..." button in the lower portion of the dialog all produce the same messages in the Xamarin console:
Broker 16.11.000.190 started successfully
Successfully connected to Local Broker
Starting IDB Local Agent...
Checking IDB.Local 16.11.000.190 installation...
Starting IDB.Local 16.11.000.190 in port 56569...
IDB.Local 16.11.000.190 started successfully
Successfully started IDB Local Agent
iTunes has not been found. Please ensure to have a valid iTunes installation in order to communicate with Apple devices in Windows
Apple Provisioning Error: Password for account smallscreensw#hotmail.com was deleted from Keychain. Please remove and add this account again.
SetSelectedDeviceAsync BEST Local Device
Checking host configuration for connecting to '192.168.1.32'...
Checking SSH configuration...
Checking host configuration for connecting to '192.168.1.32'...
Starting disconnection from 192.168.1.32...
Starting disconnection from 192.168.1.32...
The connection to '192.168.1.32' has been finished
An unexpected error occurred while checking the SSH configuration of '192.168.1.32:22'
I have tried updating the Mac, updating Visual Studio (it happens for 2019, 2022 Preview and 2022 Release Candidate versions), trying an ethernet connection instead of wireless (it happens both ways), rebooting both systems, and even changing out the hard drive.
The interesting thing about this problem is that it didn't use to happen. I had a 2012 MacBook (the lower-level Mac notebook with the white body) and never had an issue connecting until I switched to a 2020 MacBook Air running Big Sur. (The 2012 MacBook originally had Snow Leopard, then was upgraded to Mountain Lion, Yosemite, High Sierra, Mojave and Catalina (the last version of OS X available for this backlevel machine.) I never observed this issue with any of the other versions of OS X, although over time, performance began to bog down until it was more or less impractical (spurring the purchase of the new Big Sur machine).
I have absolutely no idea as to what may be happening. My first thought was maybe it's an AMD vs Intel chip thing but, as I stated, I have been able to use "Pair To Mac" before. I have never had issues with pinging to check for network connectivity (never any lost packets), and can manually run an SSH command in a terminal window on either system. I even went to the point of creating a special rule for the particular IP address at which the Mac is connected to allow incoming and outgoing connections (the pair operation apparently happens at port 22 but the rule allows all ports without distinction).
As a workaround I copy the Xamarin code (C#, XAML, etc.) directly to the Mac and work with Visual Studio for Mac, but I'd rather be doing this from the Windows laptop with the MacBook Air functioning as the server.
I searched online for similar conditions other users have experienced, but never saw anything matching this, hence my opening this problem ticket.
To aid in diagnosing the root cause of this problem/bug, I have created a OneDrive folder at this publicly available URL (read-only mode):
https://1drv.ms/u/s!AuAciPLtk4WAhwSRexATUxGZbFQj?e=32b3CN
Here's what's in the folder:
Asus Laptop Specifications.txt
A system report on the state of the Windows laptop at the time the condition occurred.
MacBook Air Laptop Specifications.txt
A system report on the state of the Mac OS laptop at the time the condition occurred.
Screenshot SSH failure Image_20211107_013742.png
An image of the failure messages from Xamarin in Visual Studio.
Xamarin Output Messages.txt
The output messages from the above screenshot, in text form.
Unexpected SSH error connecting with MacAgent in Visual Studio Video_20211107_014021.mp4
A short video demonstrating the condition and the ensuing error message.
Xamarin Forms is a fine product, but this is a real head-scratcher.
THANKS!!!!
I seem to get the An unexpected error occurred while checking the SSH configuration error when trying to pair VS 2022 to a Mac whenever I update the network password on my PC.
The following steps (based on a combination of different suggestions in this VS community post) have worked for me to get rid of this error:
Exit all instances of VS.
Delete everything from these 2 folders on the PC:
%LOCALAPPDATA%\Temp\Xamarin
%LOCALAPPDATA%\Xamarin\MonoTouch
Open VS and attempt to pair with the Mac.
a. You will be prompted for your Mac username and password.
b. The first pair attempt may fail. Wait a few seconds and try to pair again.
The above steps work with both the Xamarin version of VS 2022 and the MAUI preview version of VS 2022.

Flutter - Disk Full Error - A Document Being Saved by xcdevice

I'm running into an issue where my iMac, with over 100G free, gets Disk Full Error after running Flutter for an hour or so.
When I reboot I get dozens folders in my Trash "Recovered Files" that are around 2G each.
The issue is actually described fairly well here (with screenshots): https://github.com/flutter/flutter/issues/56270
However, the moderator closed every comment as "off topic" (seems like several people are having this problem). So I figured it may be a good idea to bring this here to see if anyone else has found a solution for this?
I'm running VSCode and when I run Flutter Doctor I'm 100% compliant. Using the latest Flutter/Dart/MacOS/Xcode/Android Studio versions. I am primarily building my Flutter app to macOS platform (desktop).
I tried the suggestions in the above issue post and none of these worked for me (re-installing cocoa pods, re-installing Xcode, re-installing Android Studio).
I actually ran into this issue about a week ago. The comment linked to had put me on the right track, where they mentioned it only happens when they have an iOS device attached to their machine.
If you see something like this error in your VSCode output log when launching your app, then it's likely the same issue.
Failed _shouldMakeReadyForDevelopment
If you have a device attached and it's locked, I believe something in the Flutter env attempts a connection over and over causing these files to fill up.
However, this happened to me once even when I didn't attach a device and I found out it was because I had "wirelessly" attached a device in Xcode when I was doing iOS development for another project. So just sitting at my desk with my iPhone nearby was enough to cause it to try to connect over and over again, even if it wasn't attached.
I removed my iPhone from Xcode's wireless device list and that seems to fix it.
Can confirm, running flutter with an attached ios device eats disk space.
This is happening to myself and another developer on my team. I lost 200 GB of disk space yesterday. It's a frustrating productivity killer.
I am using the latest flutter
flutter doctor reports everything as fine
xcrun --find simctl is fine
Using Android studio 3.6.3
Latest patched Catalina 10.15.4
This morning I opened the Android Studio IDE with an android device and an ios device connected. I opened a get info window on my hard drive and left it open. Then I did nothing but watch the info window. No builds or anything. Over the course of a couple minutes, I watched 7 GB disappear.
I shut down the IDE and the loss stopped. I reopened the IDE with only the android device attached. I waited and watched for a few minutes. No loss of disk space.
Then I reopened the IDE with just an ipad attached and the losses started again. Then I unplugged the ipad and left the IDE open and the losses stopped.
Same here but happens also when just running Android Emulator.
This needs to be fixed A.S.A.P - its a dealbreaker!
When the problem happens and the disk runs full, my system slows down so much I can hardly do a thing. To free up disk space and get operational again quickly, there's two options:
Restart. Then the cache files are either deleted or end up in "Recovered Files" in Trash, as described by #william-t, from where you can delete them.
Directly delete the cache files in "TemporaryItems" (for me that's below /private/var/folders/bc/gw57z9dn4rn2v6df7306k9sh0000gn/T)
I know this is not a solution to the root cause of the issue, and it still helps a lot, as long as there's no true fix...

Cannot run Xamarin.iOS apps on macbook from Windows Parallels (cannot install Broker)

I am trying to build a Xamarin iOS app and debug it in my mac simulator from Windows. I haven't been able to get this working all day and it is pretty time sensitive at this point.
I have updated and ensured both VS mac and windows are on the same update channels, have the same versions of Xamarin installed, cleared the cache on both mac and windows, made sure I can SSH into my machine, I can actually run the mac agent on a remote machine over VPN, but the connection is EXTREMELY slow and it is causing all sorts of different issues so debugging with it isn't an option.
The only thing I've noticed is that everyone else who seems to have this issue and shares info from their Xamarin diagnostic output shows that they're installing from Broker 4.6.* while mine seems to be trying to install Broker 1.1.6.*. This seems pretty odd, but I don't really know anything about this as I have nearly zero background in Xamarin and have just picked up this project as my company's Xamarin dev left last summer and I am developing a NativeScript app for us... someone thought they were kind of similar I guess?
Anyway, here is my output from when I attempt to connect... lastly, I used my mac's IP because the windows parallels install couldn't resolve the machine name and pointing localhost or 127.0.0.1 doesn't seem to work either although I'm not entirely sure why.
Checking host configuration for connecting to '192.168.86.29'...
Checking SSH configuration...
Checking available disk space...
Checking Mono installation...
The required Mono version to install on the Mac couldn't be determined, so the Mono validation will not continue.
Checking Xamarin iOS installation...
The required Xamarin.iOS version to install on the Mac couldn't be determined, so the Xamarin.iOS validation will not continue.
Checking host configuration for connecting to '192.168.86.29'...
Host '192.168.86.29' is configured correctly
Starting connection to '192.168.86.29'...
Installing Broker 1.1.6.181...
Unable to install the Broker
Starting connection to '192.168.86.29'...
Starting disconnection from 192.168.86.29...
Starting disconnection from 192.168.86.29...
The connection to '192.168.86.29' has been finished
An error occurred while trying to start the Broker...

How to use Xamarin's IOS Remoting Simulator

Apparently the new Xamarin iOS remoting simulator for Windows is available in the Xamarin Alpha channel for Visual Studio on Windows.
However, there seems to be no mechanism by which it will appear. There seems to be no buttons or options to show this new iOS simulator in Windows.
There is zero documentation online, or videos or forum answers relating to this
If anyone from Xamarin is following this tag, can you please elaborate.
Thanks
iOS Simulator (for Windows)
Preview Installer:
Download the preview installer and install on your Windows computer.
http://download.xamarin.com/xamarin-simulator/Xamarin.Simulator.Installer.0.9.0.25.msi
To enable the remoted iOS Simulator:
Make sure Visual Studio has connected to your Mac at least once before starting the remoted iOS Simulator.
Go to Tools > Options > Xamarin > iOS Settings and tick the box for Remote Simulator to Windows:
https://developer.xamarin.com/guides/cross-platform/windows/ios-simulator/
Update - Troubleshooting:
Update Xamarin on both your Windows and Mac machines to the latest alpha version.
** Your Xamarin plugin for VisualStudio version should now be 4.2.021+
(Verified via Tools \ iOS \ Mac Agent Console)
gv Broker42021
Requesting version of client Broker42021...
Waiting for response...
Current version of client Broker42021: 4.2.0.21
Install the Xamarin Simulator on Windows (via the download link above)
Note: This will be installed to C:\Program Files (x86)\Xamarin\Simulator
On the Mac, Kill all the Xamarin agents running on your Mac:
ps ax |grep Mono.framework
Note: When everything is running fine, you will have five (5) Mono processes running, one of which is the Xamarin.Simulator.Server.exe process:
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/XMA/Broker/4.2.0.21/Broker.exe
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/XMA/Agents/IDB/4.2.0.21/IDB.exe
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/XMA/Agents/Build/4.2.0.21/Build.exe
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/XMA/Agents/Designer/4.2.0.21/Designer.exe
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/Simulator/Server/Xamarin.Simulator.Server.exe
Buyer beware:
ps -ax |grep Mono.framework | cut -c 1-5 | xargs kill
On the Mac, kill all current sshd processes:
Note: This is assuming you are not doing this via an ssh connection ;-)
Buyer beware:
ps -ax |grep sshd | cut -c 1-5 | xargs kill
Note: You need to be root to do that, sudo su first
Over on Windows, kill ALL the Xamarin.Simulator running tasks
Note: We had a few Windows PC that had hundreds(!) of these running (?!!) (we just rebooted that machine), but found most of the ones failing to run/view the Simulator on Windows had 3-5 of these tasks running.
Since you killed all the agents on the Mac machine, Visual Studio/Xamarin will no longer be connected to the Mac, so re-connect.
Note: Make sure that you have Remote Simulator to Windows option already checked before reconnecting to the Mac build host.
F5 / Debug - Start Debugging your iOS project
Flip over to task manager and you should see one Xamarin.Simulator process running now:
After a second or two and some CPU usage spikes on that process and it should appear:
Tested on:
Parallels Desktop 11 / Business Edition (11.1.2+)
** Mac host / Windows Guest
Physical Windows and Mac machines
My Parallels setup that I use on all deployed Macs:
In the Parallels VM (Windows) configuration, add a second network adapter to the Windows guest that is assigned as a Host-Only and use that IP address as the Mac host for Xamarin connections, NOT the public, shared or bridged IP addresses.
Within Windows, disable the Firewall on this host-only adapter.
Do not use the bonjour/Window sharing Mac host name (XXXX.local), use the private IP address that is assigned to the host-only interface/network adapter. Add another Mac connection and enter the IP address, not the host name, and do not use one that Xamarin auto-adds to the list that includes the XXXX.local host name...
In the Mac, if using Little Snitch make sure that you have a rule that allows inbound connections from that Windows host-only IP address range to the launchd process (/sbin/launchd is the process that spawns the sshd processes)
Still not launching the Simulator?
Check your Mac Console:
If you see items like:
4/30/16 11:18:00.993 AM sshd[59748]: error: connect_to 127.0.0.1 port 52421: failed.
I would assume Little Snitch (or other Mac-based firewall) is blocking the reverse secure tunnel that Xamarin is creating. I do not know why this does not cause all the other Xamarin agents (build, designer, etc..) to also fail. Disable Little Snitch to confirm (kill all Xamarin agents and sshd processes and start over). If the remote Simulator works, review your Little Snitch/firewall rules, something is amiss.
Remote simulating requires enterprise
https://developer.xamarin.com/guides/cross-platform/windows/ios-simulator/
Remoted iOS Simulator requires a Visual Studio Enterprise license
Be aware that this is the first release and it is very much still a preview. If you have issues please do reach out via our forums [0], or whatever suits you best.
If you have the just-released alpha versions of everything and it doesn't work, we will need a copy of the log files (on both visual studio and the mac) to diagnose the root of the issue. Either the forums or bugzilla would be best for that.
[0] https://forums.xamarin.com/categories/visual-studio
[1] https://bugzilla.xamarin.com/enter_bug.cgi?product=Windows%20iOS%20Simulator
Open simulator log to see what is the root cause.
%LOCALAPPDATA%\Xamarin\Logs
My log show this error
System.Security.Cryptography.CryptographicException: Key not valid
for use in specified state.
To fix the problem, I delete everything in
%localappdata%\Xamarin\MonoTouch
Disconnect the mac, forget it as well
Re-connect Mac
Itshould work now

CBCentral fails to find peripheral's service unless bluetooth is restarted

I have two apps talking through CoreBluetooth, iOS and Today Extension (peripheral) and OSX (central).
1 - Setup process (iOS app x OSX app): They connect, exchange data that is stored and disconnect.
2 - App's main feature usage (iOS Today Extension x OSX app): They connect, exchange data and disconnect.
Unless I turn my iPhone's bluetooth off and on again between step 1 and 2, OSX app, finds iPhone, connects, but finds 0 services from Today Extension after peripheral.discoverServices is called in OSX app.
If I do turn bluetooth off and on, everything goes as expected. What could it be? Any help is very welcome. Thanks!
UPDATE: After using LightBlue on OSX I was able to confirm that, unless I restart bluetooth, the UUID service used in step 1 continues to be advertised, only when I restart bluetooth, UUID used in step 2 shows up.
I got the same problem, first thought it might be my fault, but later it turns out to be really weird.
I wrote similar program, using iPhone to connect to a BLE beacon, and use [CBPeripheral readRSSI] to get the signal strength. Everything goes smooth when the BLE beacon is connected to my iPhone for the first time. But if it got disconnected, and reconnect again, the method readRSSI won't get called any more.
Only after I restart the bluetooth on my iPhone, the issue will be resolved.
I run the program in debug mode, step by step, to my surprise, I found no problem at all. Even I disconnect for so many times and reconnect again, the method readRSSI can still be called properly.
Hope this may help. I am also waiting for an answer for this strange thing.

Resources