问题描述
我按照此链接中的说明创建了一个简单的移动Android Studio 中的/wearable 应用.但是,它不会识别任何特定于可穿戴 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,并尝试修改 build.gradle 文件中的最小、目标和编译 SDK,将它们设置为 19、20 或 Android-L,但我有相同的结果 - 由于这些无法识别的类,程序将无法编译.任何输入表示赞赏!谢谢
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 Studio 0.8.0,请更新到 0.8.1 -- 0.8.0 的模板中存在错误,并使用 extend 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).
这篇关于在 Android Studio 中编译简单的可穿戴应用程序 - 未找到 WatchActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!