AndroidX.无法确定androidx.multidex:multidex:2.0.0的工件 [英] AndroidX. Could not determine artifacts for androidx.multidex:multidex:2.0.0
问题描述
我尝试将项目迁移到AndroidX.
I try to migrate a project to AndroidX.
迁移3分钟后,出现错误:
After 3 minutes of migrating it finished with error:
Gradle导入 错误C:\ Users \ user \ AndroidStudioProjects \ project \ app \ build.gradle 项目 ':app':无法建立Kotlin项目配置详细信息: org.gradle.api.artifacts.ResolveException:无法解决所有问题 配置依赖 ':app:implementationDependenciesMetadata'.由以下原因引起: org.gradle.internal.resolve.ArtifactResolveException:无法 确定androidx.room:room-runtime:2.0.0的工件 创建人:org.gradle.api.resources.ResourceException:无法获取资源 ' https://dl.google.com/dl/android/maven2/androidx/room/room-runtime/2.0.0/room-runtime-2.0.0.aar ".原因 创建人:org.gradle.internal.resource.transport.http.HttpRequestException: 无法HEAD ' https://dl.google.com/dl/android/maven2/androidx/room/room-runtime/2.0.0/room-runtime-2.0.0.aar ".原因 创建人:javax.net.ssl.SSLHandshakeException:远程主机关闭的连接 握手期间导致的原因:java.io.EOFException:SSL对等体关闭 不正确地向下
Gradle import errorsC:\Users\user\AndroidStudioProjects\project\app\build.gradleproject ':app': Unable to build Kotlin project configurationDetails: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':app:implementationDependenciesMetadata'.Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not determine artifacts for androidx.room:room-runtime:2.0.0Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/room/room-runtime/2.0.0/room-runtime-2.0.0.aar'.Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not HEAD 'https://dl.google.com/dl/android/maven2/androidx/room/room-runtime/2.0.0/room-runtime-2.0.0.aar'.Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeCaused by: java.io.EOFException: SSL peer shut down incorrectly
失败:构建失败,并出现异常.
FAILURE: Build failed with an exception.
出了什么问题:
无法解析配置':app:debugRuntimeClasspath'的所有依赖项.
Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
无法确定 androidx.multidex:multidex:2.0.0的工件
Could not determine artifacts for androidx.multidex:multidex:2.0.0
无法获取资源'
无法HEAD'握手期间远程主机关闭的连接SSL对等端错误地关闭 Remote host closed connection during handshake SSL peer shut down incorrectly 尝试: 使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解. 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. 如何解决 build.gradle(项目): build.gradle (project): build.gradle(应用程序): build.gradle (app): 更新 我更新了所有依赖库.然后在项目的build.gradle中添加 I updated all libraries in dependencies. Then in project's build.gradle I added
在两个分支中 到 to 出了什么问题:无法确定任务':app:kaptDebugKotlin'的依赖关系. What went wrong: Could not determine the dependencies of task ':app:kaptDebugKotlin'. 无法解决配置':app:kapt'的所有任务依赖项. Could not resolve all task dependencies for configuration ':app:kapt'. 无法解析androidx.room:room-compiler:2.1.0. Could not resolve androidx.room:room-compiler:2.1.0. 要求者: 项目:app 无法解析androidx.room:room-compiler:2.1.0. Could not resolve androidx.room:room-compiler:2.1.0. 无法获取资源' https://dl.google.com/dl/android/maven2/androidx/room/room-compiler/2.1.0/room-compiler-2.1.0.pom " 无法获取' https://dl.google.com/dl/android/maven2/androidx/room/room-compiler/2.1.0/room-compiler-2.1.0.pom ". 握手过程中的远程主机关闭连接 Remote host closed connection during handshake 无法解析androidx.room:room-compiler:2.1.0. Could not resolve androidx.room:room-compiler:2.1.0. 无法获取资源'无法获取' https://dl.google.com/dl/android/maven2/androidx/room/room-compiler/2.1.0/room-compiler-2.1.0.pom ". 握手过程中的远程主机关闭连接 Remote host closed connection during handshake
我在 I added in 因此,它看起来像: 然后同步gradle文件.它从Maven下载了一些库.编译后出现另一个错误.然后我再次按 Then synced gradle file. It downloaded some libraries from Maven. After compiling I got another error. Then I pressed 另请参见 https://developer.android.com/jetpack/androidx/migrate了解什么库和样式在AndroidX中变成了什么. See also https://developer.android.com/jetpack/androidx/migrate to understand what library and styles becomes what in AndroidX. 奇怪,但是在编译并删除 Strange, but after compiling and removing 从 back from 这篇关于AndroidX.无法确定androidx.multidex:multidex:2.0.0的工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!multidex
和Maven
的问题?buildscript {
ext.compile_sdk_version = 29
ext.min_sdk_version = 16
ext.target_sdk_version = 29
ext.kotlin_version = '1.3.40'
ext.supportLibraryVersion = "28.0.0"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Firebase.
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
signingConfigs {
...
}
compileSdkVersion compile_sdk_version
defaultConfig {
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
vectorDrawables.useSupportLibrary = true
}
buildTypes {
debug {
applicationIdSuffix '.debug'
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
multiDexEnabled true
}
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// Adds the "release" signing configuration to the release build type.
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
...
implementation 'androidx.multidex:multidex:2.0.0'
}
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
repositories
.编译后我得到了:repositories
in both branches. After compilation I got:
推荐答案
build.gradle
(项目)中添加了以下几行:build.gradle
(project) these lines:maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
buildscript {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.40"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Sync Project with Gradle files
.Sync Project with Gradle files
again.maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
build.gradle
返回,应用程序再次运行.build.gradle
, the application run again.