First, You should built appropriate folder structure in order to match default structure that Gradle is expecting. In Your gradle.build inside android{} section You should add:
sourceSets {
instrumentTest.setRoot('src/instrumentTest')
}
then You should create appropriate folder structure in your src/ folder. Now You should have main/java/your/package/name/YourActivity.java . In order for Gradle to find Your tests You should create structure in src/ folder to mirror Your main structure, like: instrumentTest/java/your/package/name/YourActivityTest.java
next, for Gradle to compile your dependencies You should add in Your gradle.build:
dependencies {
instrumentTestCompile 'com.jayway.android.robotium:robotium-solo:4.2'
instrumentTestCompile 'junit:junit:4.10'
}
Remember, that those are dependencies outside Your buildscript{} section. After You apply those changes You should be able to run Your JUnit tests as well as Robotium tests. Do not forget to hit the 'make' button couple of times for Gradle to catch up.