Android Studio 3 + Gradle 4.0 + shrinkResources + libraryProject = Unable to find a matching configuration in project

前端 未结 4 2095
执笔经年
执笔经年 2021-01-11 19:03

I\'ve problems to migrate my project to the newest Gradle 4.0 + Android Studio 3 version, which gives me all kind of errors. Little by little I managed to sort them all out

4条回答
  •  攒了一身酷
    2021-01-11 19:54

    IF your app includes a build type that a library dependency does not.

    For example, your app includes a "staging" build type, but a dependency includes only a "debug" and "release" build type.

    You will get error like

    Unable to resolve dependency for ':app@staging/compileClasspath': Could not resolve project :library. Open File Show Details

    You can resolve this error by adding

    buildTypes {
            staging {
                proguardFile getDefaultDexGuardFile('dexguard-release.pro')
                proguardFile 'dexguard-rules.pro'
                matchingFallbacks = ['debug', 'release'] //add this line
            }
        }
    

    Resolve build errors related to dependency matching official docs

提交回复
热议问题