user3184899
user3184899

Reputation: 3069

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!

Upvotes: 5

Views: 8299

Answers (4)

StuStirling
StuStirling

Reputation: 16191

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.

Upvotes: 1

nikosprodro
nikosprodro

Reputation: 21

@JPM I had the same problem.

By checking the "Problems" tab (at the bottom panel), I saw that the application could not find the jar "wearable-1.0.0/bin/wearable-1.0.0.jar". In order to create this file, I did the following:

  1. At the properties of the wearable-1.0.0 project I checked is Library and that the Build Target is Android 4.4W
  2. I Build the wearable-1.0.0 project again (right click -> Build Project)

So, this created the bin directory as well as the jar file and I was able to run my Wear Application at my samsung watch

I hope this helps

Upvotes: 0

thomtrance
thomtrance

Reputation: 31

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

Upvotes: 3

Wayne Piekarski
Wayne Piekarski

Reputation: 3232

It is important to update to the latest Android Studio 0.8.1. When you download Android Studio, it will be 0.8.0, so you need to immediately let it install the updates. There were some bugs in the examples in 0.8.0 that 0.8.1 addresses.

Upvotes: 0

Related Questions