迁移到Gradle插件3.0

我将我们的项目迁移到Gradle 3.0插件,我错误的是我是Gradle中的新成员。

现在,我面临这个问题:

Error:Could not determine the dependencies of task ':ComponentsLib:mergeProdReleaseResources'. > Could not resolve all task dependencies for configuration ':ComponentsLib:prodReleaseRuntimeClasspath'. > Could not resolve project :Datastore. Required by: project :ComponentsLib > Project :ComponentsLib declares a dependency from configuration 'releaseCompile' to configuration 'prodRelease' which is not declared in the descriptor for project :Datastore. 

这里是ComponentLib模块的gradle.build:

 apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { flavorDimensions "default" publishNonDefault true compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false } } productFlavors { internal { minSdkVersion rootProject.ext.debugMinSdkVersion } prod { } } dexOptions { preDexLibraries = false javaMaxHeapSize "2g" } lintOptions { quiet false warningsAsErrors true abortOnError true checkReleaseBuilds false textReport = true htmlReport = false xmlReport = false ignore(rootProject.ext.lintIgnore as String[]) } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) debugCompile project(path: ':Datastore', configuration: 'internalDebug') releaseCompile project(path: ':Datastore', configuration: 'prodRelease') } 

这里是数据存储模块的gradle.build:

 apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { flavorDimensions "default" publishNonDefault true compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false } } productFlavors { internal { minSdkVersion rootProject.ext.debugMinSdkVersion } prod { } } dexOptions { preDexLibraries = false javaMaxHeapSize "2g" } lintOptions { quiet false warningsAsErrors true abortOnError true checkReleaseBuilds false textReport = true htmlReport = false xmlReport = false ignore(rootProject.ext.lintIgnore as String[]) } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) debugCompile project(path: ':Core', configuration: 'internalDebug') releaseCompile project(path: ':Core', configuration: 'prodRelease') } 

这些模块按顺序构建 – >’:Core’,’:Datastore’,’:ComponentsLib’,’:Push’,….

有什么想法发生在这里? 谢谢。

我终于修好了。 Porblem是我不得不重写

  debugCompile project(path: ':Datastore', configuration: 'internalDebug') releaseCompile project(path: ':Datastore', configuration: 'prodRelease') 

 instalation project(':Datastore') 

因为新的Gradle 3.0插件以不同的方式管理构建过程。