Android wear - eclipse: doesn't recognize support library

I am trying to develop using the new Wear sdk.

I downloaded everything I needed, including support libraries, and installed wear for Android. the problem is that the project cannot find wearable libra.

Example code error line:

WatchActivity cannot be resolved to a type 

and

 The import android.support.wearable cannot be resolved 

Thank you, Yakir.

+6
source share
3 answers

I looked at the same problems using Eclipse and the answer to my problem was related to the link I found:
http://blog.benjamin-cabe.com/2014/07/04/how-to-setup-eclipse-for-android-wear-development

WatchActivity:

just do not use WatchActivity - use standard activity instead.

Import android.support.wearable cannot be allowed:

The first step is to make sure that you have installed Google Repository Extra in your SDK manager. It should be somewhere below the Android Support Repository
enter image description here

After downloading the Google Repository :
In Android Studio, you just need to add the dependency for libable-support lib, as here: https://developer.android.com/training/wearables/apps/layouts.html#UiLibrary .
But if you want to use any class from the android.support.wearable package from Eclipse, this is a bit complicated.

The wearable package is not part of the standard Android support library. You need to use the downloadable UI support library located in the Google repository: com.google.android.support:wearable
Unlike standard Android support libraries, this file is not provided in the form of a file or project .jar code, which can be imported directly to the workspace, but in .aar format (for example, jar , but also including res )).

Please find this file here regarding your sdk folder:
./extras/google/m2repository/com/google/android/support/wearable/1.0.0/wearable-1.0.0.aar

  • wearable-1.0.0.aar file anywhere in your workspace (you can see that it looks almost like a standard Android project).
  • Move classes.jar to /libs/classes.jar
  • Now you need to create a new project from these files, with the package name defined as android.support.wearable
  • Compile it with API 20 and select "Is the library" in the project properties.
  • Add a link to this library project from your project

I urge you to take a look at this blog post. Gradually, everything is explained well. If you have any project, feel free to ask here.

+12
source

You can ignore the WatchActivity compilation WatchActivity , see my answer here: fooobar.com/questions/971441 / ....

If you cannot find android.support.wearable , be sure to follow step 4. in this guide: http://developer.android.com/preview/google-play-services-wear.html

0
source

You can find the wearable library in the Google Repository folder. For how to extract and use it, you can refer to https://medium.com/@tangtungai/how-to-develop-and-package-android-wear-app-using-eclipse-ef1b34126a5d

Hope for this help

0
source

Source: https://habr.com/ru/post/971440/


All Articles