我为Android UI测试创建了仅测试模块。它适用于AS2.3,但当我升级到AS3.0时,我看到下面的问题:
>Cannot choose between the following:
configurations of project :abcMobile:
- normalDebugApiElements
- xxxDebugApiElements
- yyyDebugApiElements
- zzzDebugApiElements
All of them match the consumer attributes:
- Configuration 'normalDebugApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Apk' and found compatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'normalDebug' but wasn't required.
- Found market 'normal' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
- Configuration 'xxxDebugApiElements':........
以下是仅测试模块的gradle片段: android { compileSdkVersion project.ext.compileSdkVersion targetProjectPath':abcMobile' targetVariant' normalDebug'
defaultConfig {
applicationId "com.abc.mobile.functional.tests"
minSdkVersion project.ext.ebayMinSdkVersion
targetSdkVersion project.ext.ebayTargetSdkVersion
multiDexEnabled true
}
buildTypes {
debug {........
.....
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dependencies {
implementation project(':xyz')
implementation group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
....
....
....
....
}
答案 0 :(得分:1)
通过添加解决了这个问题 missingDimensionStrategy'< flavorDimensions>','< productFlavors>” 在defaultConfig {}
下有关详细信息,请参阅:https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#flavor_dimensions