By default, the Xamarin.Android installer will put the Android SDK in following location on a Windows computer: C:UsersusernameAppDataLocalAndroidandroid-sdk. Download the USB Drivers. Google Nexus devices (with the exception of the Galaxy Nexus) require the Google USB Driver. The driver for the Galaxy Nexus is distributed by Samsung. Our website provides a free download of Xamarin Test Recorder 0.11.0.0 for Mac. This free software for Mac OS X is an intellectual property of Xamarin Inc. The application lies within Developer Tools, more precisely General.
-->
This article explains how to setup an Android device and connect it to a computer so that the device may be used to run and debug Xamarin.Android applications.
![]()
After testing on an Android emulator, you will want to see and test your apps running on an Android device. You will need to enable debugging and connect the device to the computer.
Each of these steps will be covered in more detail in the sectionsbelow.
Enable Debugging on the Device
A device must be enabled for debugging in order to test an Androidapplication. Developer options on Android have been hidden by defaultsince version 4.2, and enabling them can vary based on the Androidversion.
Android 9.0+
For Android 9.0 and higher, debugging is enabled by followingthese steps:
Android 8.0 and Android 8.1
Android 7.1 and lower
Verify that USB debugging is enabledXamarin Studio Mac
After enabling developer mode on your device, you must ensure that USB debuggingis enabled on the device. This also varies based on the Android version.
Android 9.0+
Navigate to Settings > System > Advanced > Developer Options and enable USB Debugging.
Android 8.0 and Android 8.1
Navigate to Settings > System > Developer Options and enable USB Debugging.
Android 7.1 and lower
Navigate to Settings > Developer Options and enable USB Debugging.
Once the Developer Options tab is available under Settings >System, open it to reveal developer settings:
This is the place to enable developer options such as USB debugging andstay awake mode.
Connect the device to the computer
The final step is to connect the device to the computer. The easiest andmost reliable way is to do so over USB.
You will receive a prompt to trust the computer on your device if you havenot used it for debugging before. You can also check Always allow from thiscomputer to prevent requiring this prompt each time you connect the device.
Alternate connection via Wifi
It is possible to connect an Android device to a computer without using a USB cable, over WiFi. This technique requires more effort but could be useful when the device is too far from the computer to remain constantly plugged-in via cable.
Connecting over WiFi
By default, theAndroid Debug Bridge (ADB)is configured to communicate with an Android device via USB. It ispossible to reconfigure it to use TCP/IP instead of USB. Todo this, both the device and the computer must be on the same WiFinetwork. To setup your environment to debug over WiFi complete the following stepsfrom the command line:
Xamarin Mac AgentTroubleshooting
In some cases you might find that your device cannot connect to the computer. In this case you may want to verify that USB drivers are installed.
Install USB Drivers
This step is not necessary for macOS; just connect the device to theMac with a USB cable.
It may be necessary to install some extra drivers before a Windowscomputer will recognize an Android device connected by USB.
Note
These are the steps to set up a Google Nexus deviceand are provided as a reference. Steps for your specific device mayvary, but will follow a similar pattern. Search the internet for yourdevice if you have trouble.
Run the android.bat application in the [Android SDK install path]toolsdirectory. By default, the Xamarin.Android installer will put theAndroid SDK in following location on a Windows computer:
C:Users[username]AppDataLocalAndroidandroid-sdk
Xamarin Forms MacDownload the USB Drivers
Google Nexus devices (with the exception of the Galaxy Nexus) requirethe Google USB Driver. The driver for the Galaxy Nexus isdistributed by Samsung.All other Android devices should use theUSB driver from their respective manufacturer.
Install the Google USB Driver package by starting the Android SDKManager, and expanding the Extras folder, as can be seen in thefollow screenshot:
Check the Google USB Driver box, and click the Apply Changes button.The driver files are downloaded to the following location:
[Android SDK install path]extrasgoogleusb_driver
The default path for a Xamarin.Android installation is:
C:Users[username]AppDataLocalAndroidandroid-sdkextrasgoogleusb_driver
Installing the USB Driver
After the USB drivers are downloaded, it is necessary to install them.To install the drivers on Windows 7:
Summary
This article discussed how to configure an Android device fordevelopment by enabling debugging on the device. It also covered how toconnect the device to a computer using either USB or WiFi.
Related LinksComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |