We have been doing some testing of Android Wear applications on devices with round displays, and are excited about the apps that are ready to go right now. I wanted to share a few hints about dealing with some common pitfalls, where some apps would fail with exceptions, since they were not tested on the AndroidWearRound emulator from the Android SDK.
The most common mistake can occur when using WatchViewStub, which inflates either a rect_activity_my.xml or a round_activity_my.xml. A developer might mistakenly add the UI views to only the rectangular layout file and make calls to findViewById(). Since the round layout was not filled out, findViewById() will return null, and will then throw a NullPointerException.
If you want to use the same layout between devices, or if you require a rectangular layout, you can use BoxInsetLayout from the wearable support library. This layout ensures that everything will automatically be kept within a box that fits within any round display. To find out more about designing for round displays, check out this I/O Byte video Fullscreen apps for Android Wear
Make sure that you test your apps on your current square devices, the AndroidWearSquare emulator, and the AndroidWearRound emulator. This way, your applications will be ready and working for when round devices start arriving in the market soon!
Note: there is a bug in the current AVD setup where there are three AndroidWearRound profiles available to choose from in the “Device” dropdown. Make sure you pick the middle one for now, one of the others is not correct. This is currently being fixed and should be released to the public soon.