【问题标题】:Could not resolve all files for configuration ':app:debugRuntimeClasspath' / app:_agp_internal_javaPreCompileDebug_kaptClasspath'无法解析配置的所有文件 \':app:debugRuntimeClasspath\' / app:_agp_internal_javaPreCompileDebug_kaptClasspath\'
【发布时间】:2022-08-06 12:03:29
【问题描述】:

我搜索了很多,但我没有解决这个问题:

造成的:org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:无法解析配置\':app:debugRuntimeClasspath \'的所有文件。

这个错误:

造成的:org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: 无法解析所有配置文件\':app:_agp_internal_javaPreCompileDebug_kaptClasspath\'。

我已经尝试了所有解决方案但无法正常工作。

错误 :

build.gradle(项目)

// Top-level build file where you can add configuration options common to all sub- 
projects/modules.
buildscript {
ext.kotlin_version = \"1.6.20\"
repositories {
    google()
    jcenter()

}
dependencies {
    classpath \'com.android.tools.build:gradle:7.1.2\'
    classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version\"
    classpath \'com.google.gms:google-services:4.3.10\'

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

allprojects {
repositories {
    google()

    mavenCentral()

    maven {
        url \"https://jitpack.io\"
    }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

build.gradle(模块):

apply plugin: \'com.android.application\'
apply plugin: \'kotlin-android\'
apply plugin: \'kotlin-android-extensions\'
apply plugin: \'com.google.gms.google-services\'
apply plugin: \'kotlin-kapt\'


android {
compileSdkVersion 32

defaultConfig {
    applicationId \"com.myapp.medled\"
    minSdkVersion 22
    targetSdkVersion 32
    versionCode 1
    versionName \"1.0\"

    testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile(\'proguard-android-optimize.txt\'), \'proguard- 
rules.pro\'
    }
}
}

dependencies {

def nav_version = \"2.4.2\"
def room_version = \"2.5.0\"
def archLifecycleVersion = \'2.5.0-beta01\'

implementation \"androidx.room:room-runtime:2.4.2\"
implementation \'com.google.firebase:firebase-database:20.0.4\'
kapt \"androidx.room:room-compiler:$room_version\"
implementation \"androidx.room:room-ktx:$room_version\"
testImplementation \"androidx.room:room-testing:$room_version\"

implementation \"androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion\"
kapt \"androidx.lifecycle:lifecycle-compiler:2.4.2\"
implementation(\"androidx.lifecycle:lifecycle-runtime-ktx:2.5.0-beta01\")
implementation(\"androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0-beta01\")

implementation \'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1\'
implementation fileTree(dir: \"libs\", include: [\"*.jar\"])
implementation \"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version\"
implementation(\"androidx.core:core-ktx:1.7.0\")

implementation \'androidx.appcompat:appcompat:1.4.1\'
implementation \'androidx.legacy:legacy-support-v4:1.0.0\'
implementation \'androidx.constraintlayout:constraintlayout:2.1.3\'
implementation(\"androidx.navigation:navigation-runtime-ktx:2.4.2\")
implementation(\"androidx.navigation:navigation-fragment-ktx:2.4.2\")
implementation(\"androidx.navigation:navigation-ui-ktx:2.4.2\")

implementation \"androidx.navigation:navigation-dynamic-features-fragment:$nav_version\"

implementation \'com.google.firebase:firebase-auth:21.0.3\'
androidTestImplementation \"androidx.navigation:navigation-testing:$nav_version\"
testImplementation \'junit:junit:4.12\'
androidTestImplementation \'androidx.test.ext:junit:1.1.3\'
androidTestImplementation \'androidx.test.espresso:espresso-core:3.4.0\'
implementation platform(\'com.google.firebase:firebase-bom:29.3.1\')
implementation \'com.google.firebase:firebase-analytics-ktx\'
implementation \'androidx.legacy:legacy-support-v4:1.0.0\'
implementation \'androidx.legacy:legacy-support-core-utils:1.0.0\'
}
  • 不是 100% 肯定,但我的猜测是它是由依赖项之间的不兼容问题引起的。您添加或升级的最后一个库是哪个?

标签: android android-studio kotlin gradle


【解决方案1】:

此错误是由您的依赖项之一引起的 要解决此问题,请转到您的 build.gradle 文件并查看所有依赖项并检查版本是否正确或任何其他拼写错误可能其中一个未正确指向其存储库,我希望这可以帮助您..

【讨论】:

    猜你喜欢
    • 2021-09-03
    • 2022-08-19
    • 2022-08-02
    • 2022-10-25
    • 2021-05-19
    • 2023-01-07
    • 2019-05-10
    • 2019-03-05
    • 2021-12-05
    相关资源
    最近更新 更多