我正在尝试IntelliJ16EAP,我无法正确地导入android项目。不承认频域测试是项目的一部分。

我正在导入的项目是一个示例项目,可以在github上找到:
https://github.com/robolectric/deckard
这是build.gradle文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
repositories {
jcenter()
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 18
targetSdkVersion 23
versionCode 2
versionName "1.0.0-SNAPSHOT"
applicationId "com.example"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'LICENSE.txt'
}
}
dependencies {
// Support v4
compile 'com.android.support:support-v4:23.1.1'
// Espresso
androidTestCompile 'com.android.support:support-annotations:23.1.1'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1'
// Robolectric
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.apache.maven:maven-ant-tasks:2.1.3' // fixes issue on linux/mac
testCompile 'org.robolectric:robolectric:3.0'
}有线索知道为什么会发生这种事吗?
编辑: 1)如果我从gradle中删除所有android插件,然后添加java插件,立即识别单元测试并将它们添加到项目中。然后,一旦我切换回android插件,intellij再次删除它。2)我尝试了Intellij 15和AndroidStudio2.0,并且得到了相同的结果
发布于 2016-01-07 15:26:57
经过一番挖掘,我发现这似乎是一种预期的做事方式。您只能在任何时候在项目中导入插装测试或单元测试。您可以在“构建变体”窗口中的2之间切换。

我还发现了https://www.youtube.com/watch?v=vdasFFfXKOY&index=3&list=LLM9iluZir-2dWQTQ-WfJdbw的视频,在15:30中,描述了这种奇怪的行为。他还说,它将在AndroidStudio2.0中修复,但通过测试,情况正好相反。
发布于 2016-01-06 18:46:02
您可能必须在模块设置中将测试文件夹标记为“测试文件夹”。Ctrl+alt+shift+S

另外,最好从金丝雀频道使用AndroidStudio2.0。它以Intellij 15为基础。
https://stackoverflow.com/questions/34639166
复制相似问题