In the previous post I mentioned that upgrading to Android Studio 0.6.x broke the Robolectric Gradle plugin with the nice fault on "java.lang.NoClassDefFoundError: com.android.builder.BuilderConstants". This seems to be fixed no, and the test reports are rendered again too.
Please upgrade your build script, I've updated the code on GitHub too.
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' //new plugin classpath 'org.robolectric:robolectric-gradle-plugin:0.11.+' } } allprojects { repositories { mavenCentral() } } apply plugin: 'android' apply plugin: 'robolectric' //NOTE the change!! No longer 'android-test' android { compileSdkVersion 19 buildToolsVersion '19.1.0' defaultConfig { minSdkVersion 15 targetSdkVersion 19 versionCode 1 versionName '1.0' } buildTypes { debug { runProguard true proguardFiles 'proguard-rules.txt' } release { runProguard false proguardFiles 'proguard-rules.txt' } } sourceSets { androidTest.setRoot('src/test') } lintOptions { abortOnError false disable 'InvalidPackage' } productFlavors { } } dependencies { // ================== LIBRARIES ====================== compile fileTree(dir: 'libs', include: ['*.jar', '*.aar']) compile 'com.android.support:appcompat-v7:+' //for more information on the Butterknife injection framework //visit https://github.com/JakeWharton/butterknife compile 'com.jakewharton:butterknife:5.1.0' // for more information on the Crouton framework, // visit https://github.com/keyboardsurfer/Crouton compile 'de.keyboardsurfer.android.widget:crouton:1.8.4' // ================== TESTING LIBRARIES ====================== androidTestCompile 'junit:junit:4.10' androidTestCompile 'org.robolectric:robolectric:2.3' androidTestCompile 'com.squareup:fest-android:1.0.+' androidTestCompile 'org.bouncycastle:bcprov-jdk15on:1.50' androidTestCompile 'com.jakewharton:butterknife:5.1.0' } //NOTE! Used to be androidTest robolectric { // configure the set of classes for JUnit tests include '**/*Test.class' // configure max heap size of the test JVM maxHeapSize = "2048m" }
Geen opmerkingen:
Een reactie posten