Jmockit with gradle and android

android

(Geoff Greene) #1

I’m having some trouble using jmockit in android studio
Inside of android studio, everything works fine.
However, when I try to build (gradle 2.14.1) with gradlew test, it keeps throwing errors that look to me like classpath issues, things that seem to indicate that jmockit is NOT before junit on the commandline, things like

java.lang.Exception: Method onDialogChoiceTest should have no parameters.

Normally, I realize that tests should not have parameters, however, jmockit does rewrite junit as long as it is in the right order in the classpath to alllow for this.

my build.gradle is:
apply plugin: ‘com.android.application’
android {
compileSdkVersion 19
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.foo.myapplication"
minSdkVersion 18
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.txt’
}
}
repositories {
maven { url ‘http://repo1.maven.org/maven2’ }
}
}
dependencies {
compile project(’:library’)
compile project(’:gdHandheld’)
testCompile ‘org.jmockit:jmockit:1.28’
testCompile ‘junit:junit:4.12’
compile fileTree(dir: ‘libs’, include: [’*.jar’])
}

This is driving me batty…thanks for the help