我按照 this link 中的说明进行操作在 Android Studio 中创建一个简单的移动/可穿戴应用程序。但是,它不会识别任何特定于可穿戴 SDK 的类,并给出错误“无法解析符号 ______”。截图在this link这就是我所看到的。
以下是我的build.gradle文件:
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,但我有相同的结果 - 由于这些无法识别的类,程序无法编译。任何输入表示赞赏!谢谢
最佳答案
不要扩展 WatchActivity
(该类实际上并不存在)。
Android Wear Activity 的基类就是标准的 Activity
.
(此外,如果您使用的是 Android Studio 0.8.0,请更新至 0.8.1——0.8.0 在其模板中存在错误并使用 extend WatchActivity
创建新的 Activity,这是实际上无效)。
关于android - 在 Android Studio 中编译简单的可穿戴应用程序 - 未找到 WatchActivity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24657160/