错误:无法解决:com.google.android.support:wearable:2.0.0



我最近把我的桌面换成了一个新的。安装了安卓工作室并从远程拉出我的项目。我在新的安卓工作室 3.5.1 中拥有所有 SDK 和 SDK 工具。但是当我尝试构建项目时,它在 gradle 同步时失败了。我得到的错误是:

ERROR: Failed to resolve: com.google.android.support:wearable:2.0.0
Show in Project Structure dialog
Affected Modules: wear

以下是我认为重要的一些细节。

安卓插件版本:2.3.3(我必须使用它( 分级版本:4.6

在 gradle 包装器属性中,我有这个:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip

在我的磨损模块build.gradle中,我有这个:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "A.B.C.D"
minSdkVersion 25
targetSdkVersion 28
versionCode 1252
versionName "1.2.52"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.android.support:wearable:2.0.0'
compile 'com.android.support.constraint:constraint-layout:1.1.3'
compile 'com.google.android.wearable:wearable:2.0.0'
compile 'commons-io:commons-io:2.5'
compile 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//    compile "com.google.firebase:firebase-core:17.0.1"
//    compile project(':library')
compile project(':XYZ')
}
apply plugin: 'com.google.gms.google-services'

我尝试了以下方法,但没有一个有效:

  1. 确保我的 JAVA 主页指向 JDK8
  2. 多次使缓存失效并重新启动
  3. 确保 gradle 插件和 gradle 版本在项目结构中正确
  4. 还多次卸载并安装了安卓工作室。

不确定发生了什么,但我只是无法同步它。我怀疑 gradle 未被 Android 工作室正确下载和识别。任何线索都值得赞赏。

情况 1:未安装 gradle:- 您可以下载包装器并在$projectroot/gradle/wrapper/gradle-wrapper.properties中指向此包装器,然后执行./gradlew并检查错误即将发生的内容,很可能错误可能是由于代理引起的distributionUrl=https://services.gradle.org/distributions/gradle-4.10.3-bin.zip

案例2:Gradle已经进入:- 只需在控制台中运行 ./gradlew 干净组装并检查堆栈跟踪。

相关内容

最新更新