locked
Xamarin cannot see running AVDs RRS feed

  • Question

  • User19204 posted

    As per the title, things are currently not going so well with my Xamarin development.

    I've previously used Unity and Eclipse to create Android apps; Unity directly to devices and with Eclipse I've deployed to devices and AVDs.

    In Xamarin, I hit the run button and after the project is finished building, I get a dialog to select a device. There are a list of emulators available, so I click one and hit start emulator. The emulator then successfully starts. But Xamarin still claims the device is "not started", and refuses to allow me to deploy.

    The emulator is working, and Eclipse has no problem deploying to it. I've tried attaching a real device (4.2 and 4.3), and Xamarin detects neither, whereas Eclipse will happily deploy to it.

    I am at my wits end with trying to get this to work, if anyone has any ideas I can try, please let me know.

    Tuesday, July 30, 2013 8:47 PM

Answers

  • User13824 posted
    • The simplest possibility, but one you have almost certainly tried, is to push the Refresh button on the emulator list.

    • A more likely problem is that adb is not cooperating: http://docs.xamarin.com/guides/android/troubleshooting#IDEdoesnotdisplaytarget_device

    • If adb devices looks correct, and killing and restarting the adb server doesn't help, I had some trouble with the emulator list when using Java 7. Any chance you're using Java 7 too? If not, are you using all the latest Xamarin versions?

      Xamarin Studio -> About Xamarin Studio -> Show Details -> Copy Information

    • Which Android version are you using on the emulator? I would stick with 4.2 or lower for the moment.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, July 30, 2013 11:29 PM

All replies

  • User13824 posted
    • The simplest possibility, but one you have almost certainly tried, is to push the Refresh button on the emulator list.

    • A more likely problem is that adb is not cooperating: http://docs.xamarin.com/guides/android/troubleshooting#IDEdoesnotdisplaytarget_device

    • If adb devices looks correct, and killing and restarting the adb server doesn't help, I had some trouble with the emulator list when using Java 7. Any chance you're using Java 7 too? If not, are you using all the latest Xamarin versions?

      Xamarin Studio -> About Xamarin Studio -> Show Details -> Copy Information

    • Which Android version are you using on the emulator? I would stick with 4.2 or lower for the moment.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, July 30, 2013 11:29 PM
  • User19204 posted

    I have pressed that refresh button more than a thirsty man in front of some kind of slushie machine. Sadly, no effect.

    I ran adb devices, it does have the avd that's currently running listed. For completeness, I killed and restarted the server as well. Still no joy.

    I have run a variety of emulators, from 2.3 up to 4.3. Mostly I've been running 4.2, but nothing has worked on Xamarin.

    My Java version is 7 as it turns out. 1.7.0_25, or something to that effect. However, I'm pretty sure I also have 6 installed, and that's what Android & Xamarin is using (see below, under Xamarin version). Should I uninstall 7? Or is there a different work-around for this?

    For completeness; my Xamarin version is as follows: === Xamarin Studio ===

    Version 4.0.10 (build 7)

    Installation UUID: 7fcef020-62ca-4992-9e6f-806255a576d8

    Runtime:

    Microsoft .NET 4.0.30319.18052
    
    GTK 2.24.13
    
    GTK# (2.12.0.0)
    

    === Xamarin.Android ===

    Version: 4.8.0 (Starter Edition)

    Android SDK: C:\Program Files (x86)\Android\android-sdk

    Supported Android versions:
    
        2.1   (API level 7)
    
        2.2   (API level 8)
    
        2.3   (API level 10)
    
        3.1   (API level 12)
    
        4.0   (API level 14)
    
        4.0.3 (API level 15)
    
        4.2   (API level 17)
    

    Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_32

    java version "1.6.0_32"

    Java(TM) SE Runtime Environment (build 1.6.0_32-b05)

    Java HotSpot(TM) Client VM (build 20.7-b02, mixed mode, sharing)

    === Build Information ===

    Release ID: 400100007

    f324e2154ee86ae1b6b8483392eddbf418e6381b

    Build date: 2013-07-20 02:59:47Z

    Xamarin addins: fe4f180e2386eafc00087ef68c3a580cff4a2592

    === Operating System ===

    Windows 6.1.7601.65536 (64-bit)

    Wednesday, July 31, 2013 11:40 AM
  • User13824 posted

    Hahaha. Well worded! Thanks for the version info, and more importantly, apologies for the inconvenience! I'm suspicious this might be related to the Java version, but I don't see any documentation mentioning an issue, so I've filed a bug report: https://bugzilla.xamarin.com/show_bug.cgi?id=13655

    Hopefully the developers will be able to reproduce the problem and identify the cause. In the mean time, the exact version of Java 6 I've used successfully is 1.60_39. You can update your Java 6 version to match that, reboot the computer, and see if that helps.

    Wednesday, July 31, 2013 4:28 PM
  • User19204 posted

    I have updated now to 1.60_39, on both x64 and xc86 with no improvement of the situation, unfortunately.

    Thanks for posting the bug, I hope you guys manage to resolve it soon.

    Wednesday, July 31, 2013 7:08 PM
  • User13824 posted

    Shoot. I can't reproduce the problem anymore. The devices list works as expected for me in all 3 cases:

    1. With Java 1.7025 and 1.6039 both installed
    2. With just 1.70_25 installed
    3. With just 1.60_39 installed

    So a few more details for comparison, and things to try:

    1. An update for Xamarin.Android was just released on the Beta channel. Switching to the Beta channel (Help -> Check for Updates) and installing might by luck "bump" things into working.

    2. I tested an AVD with 512 MB of ram, and 200 MB of storage, and also the default set-up for "Nexus S". Both worked.

    3. The list worked for me both before and after updating the SDK Tools, Build-tools, and Platform-tools to the latest versions in the Android SDK Manager.

    4. It still seems possible that having 2 versions of Java installed might somehow cause trouble under certain conditions. You could try uninstalling one or the other version and rebooting.

    5. Similar to (1), but more thorough. If you haven't already tried it, you could uninstall Xamarin Studio and Xamarin.Android, and reinstall.

    6. I doubt it's important, but I have the r8d version of the Android NDK installed.

    7. Another unlikely possibility: maybe the Windows language settings have some effect? I don't have any localization packs installed.

    Thursday, August 1, 2013 6:29 AM
  • User19204 posted
    1. This resulted in something interesting. The first run after the installation of the beta channel builds, the emulator starts (as per usual), and begins its boot up sequence. Not long after, the device becomes available in Xamarin to deploy to. However, the device never finishes its boot up sequence, and whenever you select it and try to deploy the app to it, the following error comes up:

    ==========================================================

    Detecting installed packages

    Installing shared runtime

    Deployment failed because of an internal error: Unexpected install output: Error: Could not access the Package Manager. Is the system running?

    Deployment failed. Internal error.

    ===========================================================

    Closing the emulator and trying again results in the same issue. Closing Xamarin and trying again results in my original problem. So I can only get this error the first time Xamarin runs after installing the beta channel updates.

    1. I setup my AVD to be exactly the same as yours, no joy.

    2. I am currently using the most up to date version of the SDK available (and its tools).

    3. I've tried removing excess Java versions, no such luck.

    4. This sadly had no effect.

    5. I have the same.

    6. I don't have any of these installed (beyond English), I don't think? How do I check that?

    PS: Sorry about the numbers on my post. For some reason the forum software resets it to number one after that deluge of information at the top.

    Thursday, August 1, 2013 2:32 PM
  • User125 posted

    @shar, this is a problem that I have all the time with Android development. It's why I tend to start my cross platform development on iOS. :-p

    When i get this problem, the steps that I usually do to get around this are: 1. kill the adb server and restart it. I believe that you have already done this. 2. Stop VS on Windows, or whatever development tool that I am using. Sometimes, the X.A doesn't pick up that emulators have been started after VS loads. 3. Reboot the machine, start the emulator with the appropriate command line options, then start VS. Having the emulator running before starting the dev environment seems to be a key to success at least for me.

    A few other items, the version of Java seems to be really important. I believe that you have installed Java 6 and Java 7. I only run with Java 6 on my system.

    I haven't tried hooking up my nexus7 2013 device yet, so all of this is just the general lessons that I have learned over the years.

    PS. I love your slushie machine statement. :-) It brought a good laugh since I just got in from the doctor and have a brand new boot on my right leg.

    Thursday, August 1, 2013 3:07 PM
  • User19204 posted

    Yeah, we've actually produced the app already for iOS. I am supposed to be doing the Android version, but as you can imagine, that's been put on hold the last couple of days...

    I tried all of the steps you suggested, but I'm still getting nowhere. I'm a bit confused as to what is happening with it all, as every other program can access the emulator. Just not Xamarin.

    PS: Glad you enjoyed that. When I get frustrated, I get funny. Not sure why a doctor was fitting you for a boot though? Doesn't a cobbler do that?

    Monday, August 5, 2013 6:06 PM
  • User13824 posted

    A few more possibilities:

    • From "Help -> Open Log Directory", check the AndroidTools log. My log shows something like this:

      <
      [2013-08-06 20:43:02.9] INFO: Starting Android device monitor
      [2013-08-06 20:43:03.0] INFO: Adb server launch operation completed
      [2013-08-06 20:43:03.0] INFO: Creating android device tracker
      [2013-08-06 20:43:03.0] DEBUG: TrackDeviceTask got: emulator-5554   device
      [2013-08-06 20:43:03.0] INFO: Got new device list from adb
      [2013-08-06 20:43:03.0] DEBUG: RunShellCommand: emulator-5554 getprop
      [2013-08-06 20:43:36.2] INFO: Stopping Android device monitor
      
    • You can also look at the Ide log in the same folder to see if it mentions anything interesting.

    • You probably already tried this per Wally's suggestion, but just to be extra-thorough, you could try running the emulator via the command line.

    Wednesday, August 7, 2013 1:27 AM
  • User19204 posted

    So I have interesting news...

    Checking out the log you suggested, I have this towards the end:

    ==============================================================================================

    [2013-08-09 10:24:36.9] INFO: Starting Android device monitor [2013-08-09 10:24:37.2] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 10:25:05.6] INFO: Starting Android device monitor [2013-08-09 10:25:05.6] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 10:32:41.2] INFO: Adb server kill operation completed [2013-08-09 10:32:41.3] ERROR: Error killing adb server System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:5037 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult) at Mono.AndroidTools.Adb.AdbClient.EndConnect(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) [2013-08-09 10:32:41.3] INFO: Starting Android device monitor [2013-08-09 10:32:41.3] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 10:33:10.5] INFO: Adb server kill operation completed [2013-08-09 10:33:10.5] ERROR: Error killing adb server System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:5037 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult) at Mono.AndroidTools.Adb.AdbClient.EndConnect(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) [2013-08-09 10:33:10.5] INFO: Starting Android device monitor [2013-08-09 10:33:10.5] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 10:34:44.2] INFO: Starting Android device monitor [2013-08-09 10:34:44.2] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker()

    =============================================================================================

    Now, that said, a beta update came along, so I ran that too. This time I managed to get Xamarin to recognise the AVD, and begin installation! It all worked smoothly! I was very pleased! But also wary, and cautious. So I shut Xamarin and the AVD down, restarted both to check if it would all work again. It sadly did not. The log, once again, displayed similar messages:

    ==============================================================================================

    [2013-08-09 11:50:34.3] INFO: Starting Android device monitor [2013-08-09 11:50:34.3] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 11:50:56.1] INFO: Starting Android device monitor [2013-08-09 11:50:56.1] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 11:52:20.7] INFO: Adb server kill operation completed [2013-08-09 11:52:20.7] INFO: Starting Android device monitor [2013-08-09 11:52:20.7] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 11:54:16.3] INFO: Adb server kill operation completed [2013-08-09 11:54:16.3] ERROR: Error killing adb server System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:5037 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult) at Mono.AndroidTools.Adb.AdbClient.EndConnect(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) [2013-08-09 11:54:16.3] INFO: Starting Android device monitor [2013-08-09 11:54:16.3] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 11:54:20.3] INFO: Adb server kill operation completed [2013-08-09 11:54:20.3] ERROR: Error killing adb server System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:5037 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult) at Mono.AndroidTools.Adb.AdbClient.EndConnect(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) [2013-08-09 11:54:20.3] INFO: Starting Android device monitor [2013-08-09 11:54:20.3] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker() [2013-08-09 11:54:23.2] INFO: Starting Android device monitor [2013-08-09 11:54:23.2] ERROR: Error creating device tracker: System.Exception: Win32 error: 740 at Mono.AndroidTools.Util.Win32Interop.ThrowWin32Error() at Mono.AndroidTools.Internal.AdbStartWindowsServerProcess..ctor(String adbExe, EventHandler exited) at Mono.AndroidTools.AndroidDeviceManager.StartTracker()

    ==========================================================================================

    I tried restarting Xamarin with the AVD still running, and it made no difference. Nor did starting via the command line. The IDE files have an interesting set of messages though, I've attached them because I got tired of copying and pasting and noticed the attach a file button.

    Friday, August 9, 2013 11:01 AM
  • User13824 posted

    Any better luck with this recently? From those logs, it looks like there's a permissions problem (Error 740, also mentioned here) that's preventing Xamarin from connecting to adb. My first guess is that adb might be running with higher privileges, or that firewall software is blocking the communication between Xamarin Studio and adb.

    Friday, August 16, 2013 9:18 PM
  • User19204 posted

    Your comment about it being a permissions problem was right on the money! I've elevated Xamarin to run as an admin, and now everything works fine. Problem has been solved.

    For anyone who runs into similar issues, check the logs as above; if you have permission issues, run as admin and you'll be fine.

    Thanks guys, I can finally get back to programming!

    Tuesday, August 20, 2013 6:06 PM
  • User13824 posted

    Yes! So glad you got up and running! Interesting that this permissions configuration problem is possible. Thanks for calling attention to this, and sticking with it!

    Wednesday, August 28, 2013 12:36 AM
  • User103817 posted

    === Xamarin Studio ===

    Version 5.7 (build 661) Installation UUID: 9bc95702-0199-4cc4-b73c-50e483f9865e Runtime: Microsoft .NET 4.0.30319.34209 GTK+ 2.24.22 (MS-Windows theme) GTK# 2.12.26

    === Xamarin.Android ===

    Version: 4.20.0 (Trial Edition) Android SDK: C:\Users\Tagele\AppData\Local\Android\android-sdk Supported Android versions: 2.1 (API level 7) 2.2 (API level 8) 2.3 (API level 10) 3.1 (API level 12) 4.0.3 (API level 15) 4.2 (API level 17) 4.3 (API level 18) 4.4 (API level 19) Java SDK: C:\Program Files (x86)\Java\jdk1.7.071 java version "1.7.071" Java(TM) SE Runtime Environment (build 1.7.0_71-b14) Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

    === Build Information ===

    Release ID: 507000661 Git revision: b70bab61da996da29045ea8ee8aed1a6faedbe78 Build date: 2015-01-05 11:27:37-05 Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7

    === Operating System ===

    Windows 6.2.9200.0 (64-bit)

    Monday, February 2, 2015 1:57 PM