我正在将我们的项目迁移到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',....
知道这里发生了什么吗? 感谢。
答案 0 :(得分:0)
我终于修好了。 Porblem是我必须改写
debugCompile project(path: ':Datastore', configuration: 'internalDebug')
releaseCompile project(path: ':Datastore', configuration: 'prodRelease')
到
instalation project(':Datastore')
因为新的Gradle 3.0插件以不同的方式管理构建过程。