Reputation: 5170
I am trying to develop a simple Android Wear app but I am facing problem:
import android.support.wearable cannot be resolved
Upvotes: 12
Views: 17123
Reputation: 4541
Create a wearable module with Android Studio 4.0 and ended-up with the exact same issue! And it's 2020, 6 years later LOL.
Followed this guide to add the missing bits and pieces: https://developer.android.com/training/wearables/apps/creating
Basically my project builde.gradle didn't have those:
maven { url "https://maven.google.com" }
And this is module's gradle:
implementation 'com.google.android.support:wearable:2.8.0'
Once added, every checked properly.
PS: the maven is not even needed. Only missing implementation which clearly shows the wizard fails to create a valid module.
Upvotes: 1
Reputation: 2030
AndroidSDK uses their very own repository. After download copy all from
C:\Program Files (x86)\Android\android-sdk\extras\google\m2repository\
To your repository. So this can be resolved:
<dependencies>
<dependency>
<groupId>com.google.android.wearable</groupId>
<artifactId>wearable</artifactId>
<version>1.0.0</version> <!-- or whatever -->
</dependency>
</dependencies>
And you will get your
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.148 s
[INFO] Finished at: 2016-10-23T09:10:12+02:00
[INFO] Final Memory: 16M/15381M
[INFO] ------------------------------------------------------------------------
Upvotes: 0
Reputation: 1092
For gradle try
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
}
Upvotes: 0
Reputation: 10266
in the spirit of @Wayne Piekarski answer, I've created a repository that stores the project as you will need it for developing in Eclipse, clone it -> add it as an Android Library -> DONE!
Lets keep it simple :)
==== UPDATE ====
And if you still encounter the WearableActivity... simply replace it with another Activity of you choice.
Upvotes: 3
Reputation: 31
The instructions detailed at the link below were very helpful for my Eclipse setup.
Upvotes: 0
Reputation: 3232
The best way to get started with Android Wear is to use the latest Android Studio 0.8.1 or later, and it makes adding the support libraries to your code a lot easier. But it is possible to still use Eclipse, and I'll explain how to do it ...
Since the SDK was just released for Android Wear, you need to firstly make sure you follow these instructions to get everything up to date: http://developer.android.com/preview/google-play-services-wear.html
Here are the steps you need to do to fix your problem:
These steps might seem complicated in having to deal with the .aar file ... It is a lot easier when working with Android Studio, since you can just add a gradle rule that does all these steps for you automatically:
dependencies {
compile "com.google.android.support:wearable:1.0.+"
}
Upvotes: 11
Reputation: 422
In your Android SDK Manager, go to tools > manage add-on sites > user defined sites > new: https://dl-ssl.google.com/android/repository/addon-play-services-5.xml
Make sure you have the following (this is what I have)
1) Android SDK Tools v 23 (23.0.1 just came out)
2) Android SDK Platform-tools v 20
3) Android SDK Build-tools v 20
4) Android 4.4W (API 20)
5) Android Support Repository
6) Android Support Library
7) Everything else up to date
Resources: http://developer.android.com/preview/google-play-services-wear.html http://developer.android.com/training/wearables/apps/creating.html
Upvotes: 0