I am working on an Android project in the Android Studio IDE. Is there a way to create tests for some code in an android project that does not require an android virtual machine? I can not mark the "tests" folder as tests and create java files in it. Also, I do not see any parameters related to testing in my module.
Update:
I am trying the following build.gradle:
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
// ...
}
apply plugin: "java"
sourceSets {
simpleTest {
java {
srcDir 'test/java'
}
resources {
srcDir 'test/resources'
}
compileClasspath += sourceSets.main.runtimeClasspath
}
}
task simpleTest(type: Test) {
description = "Runs simple tests"
testClassesDir = sourceSets.simpleTest.output.classesDir
classpath += sourceSets.simpleTest.runtimeClasspath
}
But I get an error message:
12:19:10 Gradle Project 'app' update failed: The java plugin was added, but it is not compatible with Android plugins.
source
share