Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The following classes could not be found: - android.support.wearable.view.WatchViewStub

I get this error in my project on Android Studio when trying using Android Wear:

The following classes could not be found:

- android.support.wearable.view.WatchViewStub (Fix Build Path, Create Class)

Which causes those errors:

Error:(2) No resource identifier found for attribute 'rectLayout' in package...

Error:(2) No resource identifier found for attribute 'roundLayout' in package...

How could I fix this? thanks!

like image 610
user3184899 Avatar asked Oct 01 '22 10:10

user3184899


2 Answers

There's an unofficial UI library that is automatically included when you create your wearable app with the Android Studio Project Wizard. You can also add the library to your build.gradle file with the following dependency declaration:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.support:wearable:+'
    compile 'com.google.android.gms:play-services-wearable:+'
}

I created a build.gradle file under the build folder, added these dependencies lines, and all is well.

http://developer.android.com/training/wearables/apps/layouts.html#UiLibrary

like image 73
thomtrance Avatar answered Oct 03 '22 00:10

thomtrance


In Android Studio V1.1.0, after creating a new project with an Android Wear module, the dependencies are automatically added to the build.gradle file, however the problem still exists.

There are prompts to try building the project or fixing the build file but these do not work.

FIX

Close the project and reopen it.

like image 31
StuStirling Avatar answered Oct 02 '22 22:10

StuStirling