Installation and Setup
Let us know how you feel about this
last updated: 2017-06
This article walks through the installation steps and configuration details required to prepare your computer and devices for Android Wear development. By the end of this article, you'll have a working Xamarin.Android Wear installation integrated into Xamarin Studio and/or Microsoft Visual Studio, and you'll be ready to start building your first Xamarin.Android Wear application.
- Create Your First Android Wear App
The following is required to create Xamarin-based Android Wear apps:
Visual Studio or Xamarin Studio – You If you are using Visual Studio, Visual Studio 2013 Professional or later is required. If you are using Xamarin Studio, version 5.3 or later of Xamarin Studio is required.
Xamarin.Android – Xamarin.Android 4.17 or later must be installed and configured with either Visual Studio or Xamarin Studio.
Android SDK - Android SDK 5.0.1 (API 21) or later must be installed via the Android SDK Manager.
Java Developer Kit – Xamarin Android development requires JDK 1.8 or later if you are developing for API level 24 or greater (JDK 1.8 also supports API levels earlier than 24).
You can continue to use JDK 1.7 if you are developing specifically for API level 23 or earlier.
After you have installed Xamarin.Android, perform the following steps so that you're ready to build and test Android Wear apps:
- Install the required Android SDK and tools.
- Configure a test device.
- Create your first Android Wear app.
These steps are described in the following sections.
Install Android SDK and tools
Launch the Android SDK Manager:
Ensure that you have the following Android SDK and tools installed:
- Android SDK Tools v 24.0.0 or higher, and
- Android 4.4W (API20), or
- Android 5.0.1 (API21) or higher.
If you do not have the latest SDK and tools installed, download the required SDK tools and the API bits (you may need to scroll a bit to find them – the API selection is shown below):
Before you can use test your app, you must configure an Android Wear emulator or an actual Android Wear device.
Android Wear Emulator
Before you can use an Android Wear emulator, you must configure an Android Wear Android Virtual Device (AVD) using the Google Emulator Manager:
Create a new Android Virtual Device using one of the Android Wear watch configurations:
For more information about setting up an Android Wear emulator, see Set Up and Android Wear Emulator or Device.
Android Wear Device
If you have an Android Wear device such as an Android Wear Smartwatch, You can debug the app on this device instead of using an emulator. If your Wear device has a USB port, you can connect the Wear device to your computer, deploy to it, and debug the app as you would on an Android phone.
If your Wear device does not have a USB port, you can debug the app over Bluetooth by routing the app's debug output to an Android phone that is connected to your development computer as described in the following steps.
Enable USB debugging on your phone:
If you have not already done so, set up your phone for Xamarin.Android development as explained in Set Up Device for Development.
Download and install the free Android Wear app from the Google Play Store.
Enable Bluetooth debugging on the device:
Open the Settings menu on the Android device.
Scroll to the bottom of the menu and tap About.
Tap the build number 7 times.
On the Settings menu, tap Developer Options.
Confirm that ADB debugging is enabled.
Enable Debug over Bluetooth.
If Bluetooth debugging has been configured successfully, you should see a screen like the following on the Android Wear device:
When you use the
adb command to set up a debugging session (as
Getting Started), the Android
Wear device will appear in the device pulldown menu of Xamarin Studio
or Visual Studio.
Create Your First Android Wear App
Follow the Getting Started instructions to build your first watch app.
Packaging Your App
Android wear applications are always distributed with a companion Android phone app.
When you add your Android Wear application as a reference to your main Android application it is automatically assumed to be an Android Wear project and will generate all necessary XML and metadata for you. In addition, it will verify that package and version numbers match so you can easily ship your apps to Google Play.
To learn more about packaging Wear apps, see Working with Packaging.