【问题标题】:Error:Could not resolve all files for configuration错误:无法解析所有配置文件
【发布时间】:2018-03-30 20:33:43
【问题描述】:

我将 jsoup 库添加到我的 android 项目中,但我不断收到错误消息,即 android studio 无法解析所有文件以进行配置。 Image

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    compile 'com.google.firebase:firebase-firestore:11.8.0'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    apply plugin: 'com.google.gms.google-services'
    implementation files('C:/Users/Administrator/Documents/GitHub/project1/jsoup-1.11.2.jar')
    implementation files('C:/Users/Aviv/Documents/GitHub/project1/jsoup-1.11.2.jar')
    implementation files('C:/Users/Aviv/Documents/GitHub/project1/gradle/wrapper/jsoup-1.11.2.jar')
    implementation files('jsoup-1.11.2.jar')
}

Gradle 控制台上的输出

Error:Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'.
> Failed to transform file 'jsoup-1.11.2.jar' to match attributes {artifactType=android-classes} using transform JarTransform
> Transform output file C:\Users\Administrator\Documents\GitHub\project1\jsoup-1.11.2.jar does not exist.
> Failed to transform file 'jsoup-1.11.2.jar' to match attributes {artifactType=android-classes} using transform JarTransform
> Transform output file C:\Users\Aviv\Documents\GitHub\project1\jsoup-1.11.2.jar does not exist.
> Failed to transform file 'jsoup-1.11.2.jar' to match attributes {artifactType=android-classes} using transform JarTransform
> Transform output file C:\Users\Aviv\Documents\GitHub\project1\gradle\wrapper\jsoup-1.11.2.jar does not exist.

【问题讨论】:

    标签: android android-studio dependencies jsoup


    【解决方案1】:

    jar 必须在 libs 文件夹中,而不是在目录之外。

    1. 在您的应用文件夹中创建一个名为 libs 的新文件夹。
    2. 将“jsoup-1.11.2.jar”放在该 libs 文件夹中。
    3. 在你的 build.gradle 中改变这个

      实现文件('libs/jsoup-1.11.2.jar')

    还要注意下面这一行也导入了 libs 目录中的所有 jar 文件

    实现fileTree(include: ['*.jar'], dir: 'libs')

    【讨论】:

      猜你喜欢
      • 2018-05-22
      • 2021-03-16
      • 2021-12-03
      • 2018-05-05
      • 2021-09-03
      • 2022-06-11
      • 2018-11-19
      • 2020-04-17
      • 2019-05-10
      相关资源
      最近更新 更多