当我尝试运行我的AndroidTest(正在测试我的contentProvider)时,在构建过程中收到以下错误消息:
from settings import ELASTIC_FACET_SIZE
def get_queryset(self):
options = {"size": ELASTIC_FACET_SIZE} #unlimited results, use with caution
qs = super().get_queryset()
for field in self.facet_fields:
qs = qs.facet(field, **options)
return qs
这是我的build.gradle:
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\...\.gradle\caches\modules-2\files-2.1\org.apache.xmlbeans\xmlbeans\2.6.0\...\xmlbeans-2.6.0.jar
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: org.apache.xmlbeans.xml.stream.Location
有趣的是,我的App本身可以正常运行,因此似乎与测试有关。
非常感谢您的帮助。
编辑:在其他地方,建议将以下内容添加到我的build.gradle中,但这无济于事。
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.test.example"
minSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'org.dbunit:dbunit:2.5.3'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
答案 0 :(得分:0)
结果是,我需要以下依赖项:
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'junit:junit:4.12'
implementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support.test:runner:1.0.2'
因此所有人都使用implementation
。不需要testImplementation
和androidTestImplementation
。