错误:无法解析:com.google.android。支持:可穿戴:2.0.0
我最近把我的桌面换成了一个新的。安装了Android studio并从远程拉取了我的项目。我在新的android studio 3.5.1中拥有所有SDK和SDK工具。但当我尝试构建项目时,它在gradle sync失败了。我得到的错误是:错误:无法解析:com.google.android。支持:可穿戴:2.0.0,android,gradle,android-studio-3.5.1,Android,Gradle,Android Studio 3.5.1,我最近把我的桌面换成了一个新的。安装了Android studio并从远程拉取了我的项目。我在新的android studio 3.5.1中拥有所有SDK和SDK工具。但当我尝试构建项目时,它在gradle sync失败了。我得到的错误是: ERROR: Failed to resolve: com.google.android.support:wearable:2.0.0 Show in Project Structure dialog Affected Modules: wear 以下是一
ERROR: Failed to resolve: com.google.android.support:wearable:2.0.0
Show in Project Structure dialog
Affected Modules: wear
以下是一些我认为很重要的细节
Android插件版本:2.3.3(我必须使用它)
渐变版本:4.6
在gradle wrapper.properties中,我有以下内容:
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
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'
在我的磨损模块build.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
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'
我尝试了以下方法,但均无效:
不确定发生了什么,但我无法同步它。我怀疑gradle没有被Android studio正确下载和识别。任何线索都很感激 情况1:未安装gradle:- 您可以下载包装器并在$projectroot/gradle/wrapper/gradle-wrapper.properties中指向它,只需执行./gradlew并检查错误发生的原因,错误很可能是由于代理引起的
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
案例2:gradle已装入:-
只需在控制台中运行./gradlew clean assembly并检查堆栈跟踪 谢谢你的回答!唯一对我有效的解决方案是切换到Android Studio 3.4