错误:配置'internalRelease'的配置'实现'未在项目描述符中声明

时间:2018-06-14 15:01:14

标签: android android-gradle build.gradle android-productflavors android-build-flavors

我有一个core模块,它是我的应用程序的基础。这个模块有两种口味。当我尝试在没有味道的app模块中导入它时,我收到以下错误:

> Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
   > Could not resolve project :core.
     Required by:
         project :app
      > Project :app declares a dependency from configuration 'implementation' to configuration 'internalRelease' which is not declared in the descriptor for project :core.

这是我的核心build.gradle配置:

android {
    compileSdkVersion 27

    publishNonDefault true

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
    }

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

    flavorDimensions 'target'

    productFlavors {
        internal {
            dimension "target"
        }

        external {
            dimension "target"
        }
    }

    dexOptions { preDexLibraries true }
}

以下是我在app模块build.gradle中导入此模块的方法:

 implementation project(path: ':core', configuration: 'internalRelease')

1 个答案:

答案 0 :(得分:-1)

尝试使用implementation project(':core'),请参阅链接here