At the latest version of Android Studio, setting up development environment for android wear is pretty easy.You just select your target as Wear and you’re good to go.
At the second step Android Studio asks you about what you want to develop for Android Wear.Select your project type like shown below:
For example mine was a Watch Face.
If you don’t have a smartwatch you can develop on emulators provided by the Android Studio. From AVD Manager , create an Android Wear emulator.
If you have a smart watch this is the place where the struggle begins. Because some watches don’t have a usb port so you have to debug it over your phone.To be able to debug,first you should unlock developer options on android wear device(I assume that you unlocked developer option on your Android Phone).What you should do is :
Open “settings”>”about” tap “Build number” several times and developer options will be opened in the settings.
In Developer options make sure that you enabled “ADB debugging” and “Debug over Bluetooth”.
Your job with the smartwatch is over. Next , you also have to enable debugging over bluetooth from your Android phone.In settings section at the bottom you’ll see “Debugging over Bluetooth”.When you enabled it there is a status info about target and its host.Host status is “disconnected” as you see at the left image. To connect host, you have to open terminal and type :
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
After that status will be like this :
From now on you can debug your apps on your Android Wear smartwatch.But its quite disturbing to debug it on real device.It takes some time to upload so I realised that using a virtual device is more practical.