无法解析 androidx.databinding:databinding-compiler:3.5.3
Could not resolve androidx.databinding:databinding-compiler:3.5.3
我刚刚将我的项目转换为 androidX 并且项目构建成功。但是当我想要 运行 时,它在启用 java 的 android studio 3.5.3 中创建了这个错误。
这是我的项目gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
我的模块gradle文件:我在这里添加的所有依赖。
apply plugin: 'com.android.application'
android {
dataBinding {
enabled = true
}
compileSdkVersion 28
defaultConfig {
applicationId "com.exam.test"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
signingConfig signingConfigs.release
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
//Dependencies
dependencies {
api 'com.google.android.material:material:1.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-location:16.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
}
implementation 'androidx.biometric:biometric:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
googleServices.disableVersionCheck = true
构建输出: 这里的 pom 详细信息在 运行 应用程序
时未下载
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugAnnotationProcessorClasspath'.
> Could not resolve androidx.databinding:databinding-compiler:3.5.3.
Required by:
project :app
> Could not resolve androidx.databinding:databinding-compiler:3.5.3.
> Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler/3.5.3/databinding-compiler-3.5.3.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler/3.5.3/databinding-compiler-3.5.3.pom'.
> Remote host closed connection during handshake
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
出现这些类型的问题是因为某些库彼此不协调
那么你应该更新也许你的问题就会消失。
我有同样的问题,现在解决了。
首先升级您的 gradle
distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip
第二次更新你的 kotlin-plugin
类路径 "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
第三次将您的 android 工作室更新到最新版本 3.6 或更高版本
注意:这部分可能会显示错误然后你应该更新你的约束布局
实施 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
希望你能解决
最后通过提高网速解决了
这是因为网络问题。作为常规互联网,它会产生问题。但是当我提高互联网速度时,问题就解决了。
现在可以正常使用了。
我刚刚将我的项目转换为 androidX 并且项目构建成功。但是当我想要 运行 时,它在启用 java 的 android studio 3.5.3 中创建了这个错误。
这是我的项目gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
我的模块gradle文件:我在这里添加的所有依赖。
apply plugin: 'com.android.application'
android {
dataBinding {
enabled = true
}
compileSdkVersion 28
defaultConfig {
applicationId "com.exam.test"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
signingConfig signingConfigs.release
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
//Dependencies
dependencies {
api 'com.google.android.material:material:1.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-location:16.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
}
implementation 'androidx.biometric:biometric:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
googleServices.disableVersionCheck = true
构建输出: 这里的 pom 详细信息在 运行 应用程序
时未下载 FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugAnnotationProcessorClasspath'.
> Could not resolve androidx.databinding:databinding-compiler:3.5.3.
Required by:
project :app
> Could not resolve androidx.databinding:databinding-compiler:3.5.3.
> Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler/3.5.3/databinding-compiler-3.5.3.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler/3.5.3/databinding-compiler-3.5.3.pom'.
> Remote host closed connection during handshake
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
出现这些类型的问题是因为某些库彼此不协调 那么你应该更新也许你的问题就会消失。 我有同样的问题,现在解决了。
首先升级您的 gradle distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip
第二次更新你的 kotlin-plugin 类路径 "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
第三次将您的 android 工作室更新到最新版本 3.6 或更高版本 注意:这部分可能会显示错误然后你应该更新你的约束布局 实施 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
希望你能解决
最后通过提高网速解决了
这是因为网络问题。作为常规互联网,它会产生问题。但是当我提高互联网速度时,问题就解决了。
现在可以正常使用了。