我正在尝试在Android Studio中为我的Android应用程序构建UI测试.问题是我无法运行它们.我收到消息:任务'app:prepareDebugAndroidTestDependencies'的执行失败,我无法找到它的内容.当我运行我的应用程序时,它启动完美,但当我尝试运行测试时,它会显示上述消息.我的build.gradle在下面是lsited:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "ba.etf.pkks.eldaralmin.libraryapp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven {
url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
// Supports Android 4.0.3 and later (API level 15)
compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
// Supports Android 2.1 and later (API level 7), but not …Run Code Online (Sandbox Code Playgroud) android ui-testing android-studio build.gradle android-gradle-plugin
我收到消息:任务'app:prepareDebugAndroidTestDependencies'的执行失败,我无法找到它的内容.
我也试过这个答案的解决方案/sf/answers/2801372871/
错误日志:
警告:与依赖项"com.android.support:support-annotations"冲突.app(24.2.1)和测试app(23.1.1)的已解决版本有所不同.有关详细信息,请参阅http://g.co/androidstudio/app-test-app-conflict.
错误:任务':app:prepareDebugAndroidTestDependencies'的执行失败.依赖性错误.请参阅控制台了解详情
的build.gradle:
apply plugin: 'com.android.application'
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.appspot.whatshouldiwearapp.wsiw"
minSdkVersion 9
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile 'com.android.support.test:runner:0.5'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)
问题的解决方案是什么以及导致这个问题的原因是什么?