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!
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With