尝试在android studio中添加库时发生compileClassPAth错误

时间:2018-06-22 06:04:29

标签: android gradle

我尝试将库添加到我的android studio项目中,但这给了我以下错误:

.txt

我基本上在我的项目中创建了一个名为“库”的目录,并粘贴了名为“ MultipleImagePick-master”的库。

然后我将其包含在设置包中:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :libraries:MultipleImagePick-master.


Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :libraries:MultipleImagePick-master.


Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :libraries:MultipleImagePick-master.


Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :libraries:MultipleImagePick-master.



Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :libraries:MultipleImagePick-master.

然后我在项目中为此添加了依赖模块,而它试图进行构建时却遇到了这些失败。以下是我的gradle.build文件:

应用gradle版本:

include ':libraries:MultipleImagePick-master'

项目gradle版本:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "com.mima.iloveyou"
            minSdkVersion 15
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation project(':libraries:MultipleImagePick-master')
}

2 个答案:

答案 0 :(得分:1)

将ConstraintLayout库的版本设置回1.1.1

    implementation 'com.android.support.constraint:constraint-layout:1.1.1'

答案 1 :(得分:0)

在您的应用级别gradle中尝试此

implementation project(path: ':libraries:MultipleImagePick-master', configuration: 'default')