错误:无法解析配置的所有文件

时间:2018-03-30 08:46:26

标签: android android-studio dependencies jsoup

我将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 Console上的输出

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.

1 个答案:

答案 0 :(得分:1)

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

  1. 在名为libs的app文件夹中创建一个新文件夹。
  2. 放置' jsoup-1.11.2.jar'在libs文件夹里面。
  3. 在build.gradle中更改此内容
      

    实施档案(' libs / jsoup-1.11.2.jar')

  4. 另请注意,以下行也会导入libs目录中的所有jar文件

      

    实施fileTree(包括:[' * .jar'],dir:' libs')