-
Open your top level
build.gradle
file. -
Add Sonatype repo to buildscript repositories and Square Gradle Android Test Plugin to buildscript dependencies. (Older Gradle projects may automatically put this buildscript code in your project build.gradle, in which situation you should put the following in that file.)
E/AndroidRuntime( 9811): FATAL EXCEPTION: main | |
E/AndroidRuntime( 9811): java.lang.RuntimeException: Could not dispatch event: class com.partycv.event.ProfileLoadedEvent to handler [EventHandler public void com.partycv.DisplayCvActivity.onProfileUpdated(com.partycv.event.ProfileLoadedEvent)] | |
E/AndroidRuntime( 9811): at com.squareup.otto.Bus.dispatch(Bus.java:370) | |
E/AndroidRuntime( 9811): at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:352) | |
E/AndroidRuntime( 9811): at com.squareup.otto.Bus.post(Bus.java:322) | |
E/AndroidRuntime( 9811): at com.partycv.LinkedInClient$5.onSuccess(LinkedInClient.java:189) | |
E/AndroidRuntime( 9811): at com.partycv.LinkedInClient$5.onSuccess(LinkedInClient.java:1) | |
E/AndroidRuntime( 9811): at com.partycv.AsyncHandler$2.run(AsyncHandler.java:53) | |
E/AndroidRuntime( 9811): at android.os.Handler.handleCallback(Handler.java:615) | |
E/AndroidRuntime( 9811): at android.os.Handler.dispatchMessage(Handler.java:92) |
#[Tutorial] Android unit testing with Gradle, Robolectric, Dagger and Mockito Not long ago I faced the problem of setting up Gradle, Robolectric and Dagger for unit testing my app. And after tinkering a bit, I managed to make them all work together. In this tutorial I assume that you know how to work with Gradle, Robolectric, Dagger and Mockito separately.
I'm just going to show that they can work together pretty neatly, and how can they make Android testing a lot easier
##Wiring Robolectric and Gradle
First of all, you're going to need a fully set up Android project ready to be built with Gradle. And I'm assuming that you're using default project layout (e.g. your java sources are located in $projectDir/src/main/java/
)
For the next step we need to install a [Gradle Android test plugin][1] to a local maven repository:
#!/bin/sh | |
# Synchronize files into truecrypt containers using tcplay | |
DROPBOX_FOLDER="/home/USER_NAME/Dropbox/" | |
CONTAINER_PASSWORD="YOUR_TRUECRYPT_PASSWORD" | |
MOUNT_DIR="/tmp/backup_dropbox.tc" | |
MOUNT_OPTS="nodev,nosuid,rw,noatime,umask=000,uid=0,gid=0" | |
MAPPING_NAME="dropbox.tc" | |
RSYNC_BIN="/usr/bin/rsync" |