【问题标题】:Error:Failed to resolve: wearable错误:无法解决:可穿戴
【发布时间】:2018-05-28 09:52:00
【问题描述】:

我有一个现有项目,当我尝试向其添加磨损模块时,显示以下错误。当我创建一个带有磨损模块的新项目时,它正在工作。

错误:无法解决:可穿戴

项目依赖于 com.google.android.support:wearable:2.3.0 所以它也必须依赖于 com.google.android.wearable:wearable:2.3.0

错误截图

【问题讨论】:

  • 与向现有项目添加模块时相比,您在创建新项目时是否会使用不同版本的构建工具(build.gradle 文件中的 buildToolVersion)?跨度>

标签: android wear-os android-wear-2.0


【解决方案1】:

你需要像这样添加一个提供的

...
provided 'com.google.android.wearable:wearable:2.3.0'
implementation 'com.google.android.support:wearable:2.3.0'
...

还要检查您的项目级 build.gradle 是否有 google 存储库,我认为现在一些可穿戴库来自 google 而不是 jcenter。

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:deprecation"
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-31
    • 2021-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多