android - Espresso 2.2.1 exception :app:transformClassesWithDexForDebugAndroidTest -
in app want espresso in order test ui. however,when try run project,i message:
error:execution failed task ':app:transformclasseswithdexfordebugandroidtest'. > com.android.build.api.transform.transformexception: com.android.ide.common.process.processexception: java.util.concurrent.executionexception: com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.8.0_45\bin\java.exe'' finished non-zero exit value 2
this gradle setup:
apply plugin: 'com.android.application' android { compilesdkversion 24 buildtoolsversion "24.0.0" defaultconfig { applicationid "theo.testing.androidespresso" minsdkversion 18 targetsdkversion 24 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' androidtestcompile 'com.android.support:support-annotations:24.2.0' compile 'com.android.support:appcompat-v7:24.2.0' androidtestcompile('com.android.support.test.espresso:espresso- core:2.2.1') { exclude group: 'javax.inject' } androidtestcompile 'com.android.support.test:testing-support-lib:0.1' }
any ideas why happening?
thanks.
i'm pretty sure, it's third post , has same problem. you're trying use dependencies don't need have during test.
change build.gradle
dependencies section to:
dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:24.2.0' testcompile 'junit:junit:4.12' androidtestcompile 'com.android.support.test:runner:0.5' androidtestcompile 'com.android.support:support-annotations:24.2.0' androidtestcompile 'com.android.support.test.espresso:espresso-core:2.2.2' androidtestcompile('com.android.support.test.espresso:espresso-contrib:2.2.1') { // necessary avoid version conflicts exclude group: 'com.android.support', module: 'appcompat' exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.support', module: 'support-annotations' } }
google's official android testing support library
site enough start android testing.
see espresso secton
hope help
Comments
Post a Comment