在编译Android的工作室简单的可穿戴式的应用程序 - WatchActivity未找到穿戴、应用程序、未找到、工作室

2023-09-06 09:29:19 作者:红颜醉惜君っ

我遵循此链接说明创建一个简单的移动/在机器人工作室耐磨应用程序。但是,它不会承认任何具体的可穿戴式SDK类的,给人错误无法解析符号 ______ 。在此链接的截图是我所看到的。

I followed the instructions at this link to create a simple mobile/wearable app in Android Studio. However, it won't recognize any of the classes specific to the wearable SDK, giving the error "cannot resolve symbol ______". The screenshot at this link is what I am seeing.

下面是我的build.gradle文件:

The following is my build.gradle file:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'
    defaultConfig {
         applicationId 'com.example.lsykora.androidwearwidget'
         minSdkVersion 'L'
         targetSdkVersion 'L'
         versionCode 1
         versionName '1.0'
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-    rules.pro'
    }
}
productFlavors {}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// You must install or update the Support Repository through the SDK manager to use      this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v13:+'
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
}

我已经安装了所有SDK的使用SDK经理和我试图用最小,目标修修补补,并编译SDK的在build.gradle文件,将它们设置为19,20,或Android-L,但我具有相同的结果 - 计划不会因为这些无法识别的类的编译。任何输入AP preciated!谢谢

I have installed all SDK's using SDK manager and I have tried tinkering with the minimum, target, and compile SDK's in the build.gradle file, setting them to 19, 20, or Android-L, but I'm having the same results - program won't compile because of these unrecognized classes. Any input is appreciated! Thanks

推荐答案

不要延长 WatchActivity (该类实际上并不存在)。

Don't extend WatchActivity (that class doesn't actually exist).

有关Android Wear活动的基类就是标准的Activity.

The base class for Android Wear activities is just the standard Activity.

(另外,如果你使用的是Android 0.8.0版本工作室,更新到0.8.1 - 0.8.0在其模板中的错误和使用创造了新的活动延长WatchActivity ,这实际上是无效的)。

(Also, if you're using Android Studio 0.8.0, update to 0.8.1 -- 0.8.0 has a bug in its templates and creates new Activities using extend WatchActivity, which is actually invalid).