我正在尝试使用最新的Android Gradle插件创建Android库项目,并且很难理解它给我的错误。我的设置是一个java模块,android库模块和第二个android库模块。它们都属于同一个项目。
模块C(使用android库插件构建)
模块B依赖于模块A
模块C的依赖块:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':moduleA')
implementation project(':moduleB')
}
Gradle syncs fine和assemble
正确执行。我正在使用Gradle 4.6(已经尝试过4.4)和Android Gradle Plugin 3.1.2。 Android Studio和Jenkins都会出现此问题。尝试运行uploadArchives
时收到以下错误:
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':moduleC:uploadArchives'. > Could not publish configuration 'archives' > Could not resolve all files for configuration ':moduleC:archives'. > Could not resolve project :moduleB. Required by: project :moduleC > Cannot choose between the following configurations of project :moduleB: - debugApiElements - debugRuntimeElements - releaseApiElements - releaseRuntimeElements All of them match the consumer attributes: - Configuration 'debugApiElements': - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required. - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required. - Found org.gradle.usage 'java-api' but wasn't required. - Configuration 'debugRuntimeElements': - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required. - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required. - Found org.gradle.usage 'java-runtime' but wasn't required. - Configuration 'releaseApiElements': - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required. - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required. - Found org.gradle.usage 'java-api' but wasn't required. - Configuration 'releaseRuntimeElements': - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required. - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required. - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required. - Found org.gradle.usage 'java-runtime' but wasn't required.