Compiling simple wearable app in Android Studio - WatchActivity not found

android, android-studio, wear-os

Solution

Don't extend `WatchActivity` (that class doesn't actually exist).

The base class for Android Wear activities is just the standard `Activity`.

(Also, if you're using Android Studio 0.8.0, update to 0.8.1 -- 0.8.0 has a bug in its templates and creates new Activities using `extend WatchActivity`, which is actually invalid).

Problem

I followed the instructions at this link to create a simple mobile/wearable app in Android Studio. However, it won't recognize any of the classes specific to the wearable SDK, giving the error "cannot resolve symbol ______". The screenshot at this link is what I am seeing. The following is my build.gradle file: ``` apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion '20.0.0' defaultConfig { applicationId 'com.example.lsykora.androidwearwidget' minSdkVersion 'L' targetSdkVersion 'L' versionCode 1 versionName '1.0' } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' } } productFlavors {} } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') // You must install or update the Support Repository through the SDK manager to use this dependency. // You must install or update the Support Repository through the SDK manager to use this dependency. compile 'com.android.support:support-v13:+' compile 'com.google.android.support:wearable:+' compile 'com.google.android.gms:play-services-wearable:+' } ``` I have installed all SDK's using SDK manager and I have tried tinkering with the minimum, target, and compile SDK's in the build.gradle file, setting them to 19, 20, or Android-L, but I'm having the same results - program won't compile because of these unrecognized classes. Any input is appreciated! Thanks

Original source