android - Execution failed for task 'app:prepareDebugAndroidTestDependencies' -


i'm trying build ui tests android application in android studio. problem can't run them. message: execution failed task 'app:preparedebugandroidtestdependencies' couldn't find it's about. when run application, starts perfectly, when try run tests shows mentioned message. build.gradle lsited below:

    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 , later (api level 15) compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'  // supports android 2.1 , later (api level 7), not optimal later android versions. // if plan on supporting android 4.0.3 , up, don't need include this. compile 'com.embarkmobile:zxing-android-legacy:2.0.0@aar'  // convenience library launch scanning , encoding activities. // automatically picks best scanning library above two, depending on // android version , available. compile 'com.embarkmobile:zxing-android-integration:2.0.0@aar'  // version 3.0.x of zxing core contains code not compatible on android 2.2 , earlier. // affects encoding, should test if plan support these versions. // older versions e.g. 2.2 may work if need support older android versions. compile 'com.google.zxing:core:3.0.1' compile 'com.nononsenseapps:filepicker:2.1' compile 'com.astuetz:pagerslidingtabstrip:1.0.1' compile 'com.google.code.gson:gson:1.7.2' androidtestcompile 'com.android.support.test:runner:0.2' androidtestcompile 'com.android.support.test:rules:0.2' androidtestcompile 'com.android.support.test.espresso:espresso-core:2.1'  } 

my run/debug configurations tests in image below:

http://pokit.org/get/?5b2509c64e5049b1b168c99b95313d5e.jpg

can me figure out problem is?

in apps build.gradle add following within android { }:

  configurations.all {     resolutionstrategy.force 'com.google.code.findbugs:jsr305:3.0.1' } 

but why lead such?

when instrumentation tests run, both main apk , test apk share same classpath. gradle build fail if main apk , test apk use same library (e.g. guava) in different versions. if gradle didn't catch that, app behave differently during tests , during normal run (including crashing in 1 of cases).

to make build succeed, make sure both apks use same version. if error indirect dependency (a library didn't mention in build.gradle), add dependency newer version configuration ("compile" or "androidtestcompile") needs it. can use gradle's resolution strategy mechanism. can inspect dependency tree running ./gradlew :app:dependencies , ./gradlew :app:androiddependencies.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -